20
20
#include "config.h"
22
#include <boost/lexical_cast.hpp>
23
#include <boost/exception/get_error_info.hpp>
26
21
#include "drizzled/session.h"
27
22
#include "drizzled/item/string.h"
28
23
#include "drizzled/sql_list.h"
149
144
int set_var::update(Session *session)
154
var->set_default(session, type);
155
else if (var->update(session, this))
156
return -1; // should never happen
157
if (var->getAfterUpdateTrigger())
158
(*var->getAfterUpdateTrigger())(session, type);
160
catch (invalid_option_value &ex)
162
/* TODO: Fix this to be typesafe once we have properly typed set_var */
163
string new_val= boost::lexical_cast<string>(save_result.uint32_t_value);
164
if (boost::get_error_info<invalid_max_info>(ex) != NULL)
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(),
175
explanation.c_str());
177
else if (boost::get_error_info<invalid_min_info>(ex) != NULL)
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(),
188
explanation.c_str());
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(),
147
var->set_default(session, type);
148
else if (var->update(session, this))
149
return -1; // should never happen
150
if (var->getAfterUpdateTrigger())
151
(*var->getAfterUpdateTrigger())(session, type);