Throw warning (error in STRICT mode) if value for variable needed bounding. Plug-in interface also uses this. @param thd thread handle @param name variable's name @param fixed did we have to correct the value? (throw warn/err if so) @param is_unsigned is value's type unsigned? @param v variable's value @retval true on error, false otherwise (w
| 260 | @retval true on error, false otherwise (warning or ok) |
| 261 | */ |
| 262 | bool throw_bounds_warning(THD *thd, const char *name, |
| 263 | bool fixed, bool is_unsigned, longlong v) |
| 264 | { |
| 265 | if (fixed) |
| 266 | { |
| 267 | char buf[22]; |
| 268 | |
| 269 | if (is_unsigned) |
| 270 | ullstr((ulonglong) v, buf); |
| 271 | else |
| 272 | llstr(v, buf); |
| 273 | |
| 274 | if (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES) |
| 275 | { |
| 276 | my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buf); |
| 277 | return true; |
| 278 | } |
| 279 | push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
| 280 | ER_TRUNCATED_WRONG_VALUE, |
| 281 | ER(ER_TRUNCATED_WRONG_VALUE), name, buf); |
| 282 | } |
| 283 | return false; |
| 284 | } |
| 285 | |
| 286 | bool throw_bounds_warning(THD *thd, const char *name, bool fixed, double v) |
| 287 | { |