~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Lee Bieber
  • Date: 2010-12-02 02:03:01 UTC
  • mfrom: (1966.1.2 build)
  • Revision ID: kalebral@gmail.com-20101202020301-l6uel9i517aohjiy
Merge Monty - more sys_var clean up work
Merge Shrews - fix bug 682799: Multiple queries sharing same GPB Statement msg not recorded when using --replicate-query

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "config.h"
21
21
 
22
22
#include <boost/lexical_cast.hpp>
 
23
#include <boost/exception/get_error_info.hpp>
23
24
#include <string>
24
25
 
25
26
#include "drizzled/session.h"
156
157
    if (var->getAfterUpdateTrigger())
157
158
      (*var->getAfterUpdateTrigger())(session, type);
158
159
  }
159
 
  catch (boost::exception &)
 
160
  catch (invalid_option_value &ex)
160
161
  {
161
162
    /* TODO: Fix this to be typesafe once we have properly typed set_var */
162
163
    string new_val= boost::lexical_cast<string>(save_result.uint32_t_value);
163
 
    push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
164
 
                        ER_TRUNCATED_WRONG_VALUE,
165
 
                        ER(ER_TRUNCATED_WRONG_VALUE), var->getName().c_str(),
166
 
                        new_val.c_str());
 
164
    if (boost::get_error_info<invalid_max_info>(ex) != NULL)
 
165
    { 
 
166
      const uint64_t max_val= *(boost::get_error_info<invalid_max_info>(ex));
 
167
      string explanation("(> ");
 
168
      explanation.append(boost::lexical_cast<std::string>(max_val));
 
169
      explanation.push_back(')');
 
170
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
 
171
                          ER_INVALID_OPTION_VALUE,
 
172
                          ER(ER_INVALID_OPTION_VALUE),
 
173
                          var->getName().c_str(),
 
174
                          new_val.c_str(),
 
175
                          explanation.c_str());
 
176
    }
 
177
    else if (boost::get_error_info<invalid_min_info>(ex) != NULL)
 
178
    { 
 
179
      const int64_t min_val= *(boost::get_error_info<invalid_min_info>(ex));
 
180
      string explanation("(< ");
 
181
      explanation.append(boost::lexical_cast<std::string>(min_val));
 
182
      explanation.push_back(')');
 
183
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
 
184
                          ER_INVALID_OPTION_VALUE,
 
185
                          ER(ER_INVALID_OPTION_VALUE),
 
186
                          var->getName().c_str(),
 
187
                          new_val.c_str(),
 
188
                          explanation.c_str());
 
189
    }
 
190
    else
 
191
    {
 
192
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
 
193
                          ER_INVALID_OPTION_VALUE,
 
194
                          ER(ER_INVALID_OPTION_VALUE),
 
195
                          var->getName().c_str(),
 
196
                          new_val.c_str(),
 
197
                          "");
 
198
    }
167
199
  }
168
200
  return 0;
169
201
}