MCPcopy Create free account
hub / github.com/MariaDB/server / fill_status

Function fill_status

sql/sql_show.cc:8898–8943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8896
8897
8898int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
8899{
8900 DBUG_ENTER("fill_status");
8901 LEX *lex= thd->lex;
8902 const char *wild= lex->wild ? lex->wild->ptr() : NullS;
8903 int res= 0;
8904 STATUS_VAR *tmp1, tmp;
8905 enum enum_schema_tables schema_table_idx=
8906 get_schema_table_idx(tables->schema_table);
8907 enum enum_var_type scope;
8908 bool upper_case_names= lex->sql_command != SQLCOM_SHOW_STATUS;
8909
8910 if (lex->sql_command == SQLCOM_SHOW_STATUS)
8911 {
8912 scope= lex->option_type;
8913 if (scope == OPT_GLOBAL)
8914 tmp1= &tmp;
8915 else
8916 tmp1= thd->initial_status_var;
8917 }
8918 else if (schema_table_idx == SCH_GLOBAL_STATUS)
8919 {
8920 scope= OPT_GLOBAL;
8921 tmp1= &tmp;
8922 }
8923 else
8924 {
8925 scope= OPT_SESSION;
8926 tmp1= &thd->status_var;
8927 }
8928
8929 COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
8930 // Evaluate and cache const subqueries now, before the mutex.
8931 if (partial_cond)
8932 partial_cond->val_bool();
8933
8934 tmp.local_memory_used= 0; // meaning tmp was not populated yet
8935
8936 mysql_rwlock_rdlock(&LOCK_all_status_vars);
8937 res= show_status_array(thd, wild,
8938 (SHOW_VAR *)all_status_vars.buffer,
8939 scope, tmp1, empty_clex_str, tables->table,
8940 upper_case_names, partial_cond);
8941 mysql_rwlock_unlock(&LOCK_all_status_vars);
8942 DBUG_RETURN(res);
8943}
8944
8945
8946/*

Callers 1

fill_feedbackFunction · 0.85

Calls 5

get_schema_table_idxFunction · 0.85
show_status_arrayFunction · 0.85
ptrMethod · 0.45
val_boolMethod · 0.45

Tested by

no test coverage detected