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

Function find_table

sqladvisor/main.cc:610–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610TABLE_LIST * find_table(const char *table_name) {
611 SQL_I_List<TABLE_LIST> table_list = current_lex->table_list;
612 TABLE_LIST *table = table_list.first;
613 while (table != NULL) {
614 if (is_not_tmp_table(table)){
615 if (strcasecmp(table->table_name, table_name) == 0 || strcasecmp(table->alias, table_name) == 0) {
616 return table;
617 }
618 }
619 table = table->next_local;
620 }
621 return NULL;
622}
623
624//增加这个函数的目的是因为有的时候field本身table_name的值为空,一般这种情况为where column xxx ,而table_name不为空的情况则是where tbname.column xxxxx
625TABLE_LIST * find_table(Item_field * field) {

Callers 5

mysql_sql_parse_joinFunction · 0.85
mysql_sql_parse_indexFunction · 0.85
mysql_sql_parse_groupFunction · 0.85
mysql_sql_parse_orderFunction · 0.85

Calls 2

is_not_tmp_tableFunction · 0.85
find_table_by_fieldFunction · 0.85

Tested by

no test coverage detected