MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / throw_bounds_warning

Function throw_bounds_warning

sql/set_var.cc:262–284  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

260 @retval true on error, false otherwise (warning or ok)
261 */
262bool 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
286bool throw_bounds_warning(THD *thd, const char *name, bool fixed, double v)
287{

Callers 2

do_checkMethod · 0.85
do_checkMethod · 0.85

Calls 5

ullstrFunction · 0.85
llstrFunction · 0.85
my_errorFunction · 0.85
push_warning_printfFunction · 0.85
my_gcvtFunction · 0.85

Tested by

no test coverage detected