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

Function create_select_for_variable

sql/sql_parse.cc:1102–1129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1100*/
1101
1102void create_select_for_variable(const char *var_name)
1103{
1104 THD *thd;
1105 LEX *lex;
1106 LEX_STRING tmp, null_lex_string;
1107 Item *var;
1108 char buff[MAX_SYS_VAR_LENGTH*2+4+8], *end;
1109 DBUG_ENTER("create_select_for_variable");
1110
1111 thd= current_thd;
1112 lex= thd->lex;
1113 mysql_init_select(lex);
1114 lex->sql_command= SQLCOM_SELECT;
1115 tmp.str= (char*) var_name;
1116 tmp.length=strlen(var_name);
1117 memset(&null_lex_string, 0, sizeof(null_lex_string));
1118 /*
1119 We set the name of Item to @@session.var_name because that then is used
1120 as the column name in the output.
1121 */
1122 if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string)))
1123 {
1124 end= strxmov(buff, "@@session.", var_name, NullS);
1125 var->item_name.copy(buff, end - buff);
1126 add_item_to_list(thd, var);
1127 }
1128 DBUG_VOID_RETURN;
1129}
1130
1131
1132void mysql_init_multi_delete(LEX *lex)

Callers

nothing calls this directly

Calls 5

mysql_init_selectFunction · 0.85
get_system_varFunction · 0.85
strxmovFunction · 0.85
add_item_to_listFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected