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

Method do_check

sql/sys_vars.h:1017–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015 DBUG_ASSERT(size == sizeof(ulonglong));
1016 }
1017 bool do_check(THD *thd, set_var *var)
1018 {
1019 char buff[STRING_BUFFER_USUAL_SIZE];
1020 String str(buff, sizeof(buff), system_charset_info), *res;
1021
1022 if (var->value->result_type() == STRING_RESULT)
1023 {
1024 if (!(res=var->value->val_str(&str)))
1025 return true;
1026 else
1027 {
1028 char *error;
1029 uint error_len;
1030 bool not_used;
1031
1032 var->save_result.ulonglong_value=
1033 find_set(&typelib, res->ptr(), res->length(), NULL,
1034 &error, &error_len, &not_used);
1035 /*
1036 note, we only issue an error if error_len > 0.
1037 That is even while empty (zero-length) values are considered
1038 errors by find_set(), these errors are ignored here
1039 */
1040 if (error_len)
1041 {
1042 ErrConvString err(error, error_len, res->charset());
1043 my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.str, err.ptr());
1044 return true;
1045 }
1046 }
1047 }
1048 else
1049 {
1050 longlong tmp=var->value->val_int();
1051 if ((tmp < 0 && ! var->value->unsigned_flag)
1052 || (ulonglong)tmp > MAX_SET(typelib.count))
1053 return true;
1054 else
1055 var->save_result.ulonglong_value= tmp;
1056 }
1057
1058 return false;
1059 }
1060 bool session_update(THD *thd, set_var *var)
1061 {
1062 session_var(thd, ulonglong)= var->save_result.ulonglong_value;

Callers

nothing calls this directly

Calls 8

my_errorFunction · 0.85
find_setFunction · 0.70
result_typeMethod · 0.45
val_strMethod · 0.45
ptrMethod · 0.45
lengthMethod · 0.45
charsetMethod · 0.45
val_intMethod · 0.45

Tested by

no test coverage detected