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

Method do_check

sql/sys_vars.h:907–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

905 DBUG_ASSERT(size == sizeof(ulonglong));
906 }
907 bool do_check(THD *thd, set_var *var)
908 {
909 char buff[STRING_BUFFER_USUAL_SIZE];
910 String str(buff, sizeof(buff), system_charset_info), *res;
911 ulonglong default_value, current_value;
912 if (var->type == OPT_GLOBAL)
913 {
914 default_value= option.def_value;
915 current_value= global_var(ulonglong);
916 }
917 else
918 {
919 default_value= global_var(ulonglong);
920 current_value= session_var(thd, ulonglong);
921 }
922
923 if (var->value->result_type() == STRING_RESULT)
924 {
925 if (!(res=var->value->val_str(&str)))
926 return true;
927 else
928 {
929 char *error;
930 uint error_len;
931
932 var->save_result.ulonglong_value=
933 find_set_from_flags(&typelib,
934 typelib.count,
935 current_value,
936 default_value,
937 res->ptr(), res->length(),
938 &error, &error_len);
939 if (error)
940 {
941 ErrConvString err(error, error_len, res->charset());
942 my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.str, err.ptr());
943 return true;
944 }
945 }
946 }
947 else
948 {
949 longlong tmp=var->value->val_int();
950 if ((tmp < 0 && ! var->value->unsigned_flag)
951 || (ulonglong)tmp > MAX_SET(typelib.count))
952 return true;
953 else
954 var->save_result.ulonglong_value= tmp;
955 }
956
957 return false;
958 }
959 bool session_update(THD *thd, set_var *var)
960 {
961 session_var(thd, ulonglong)= var->save_result.ulonglong_value;

Callers

nothing calls this directly

Calls 8

find_set_from_flagsFunction · 0.85
my_errorFunction · 0.85
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