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

Function mysql_sql_parse_admin

sqladvisor/main.cc:1213–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211}
1212
1213void mysql_sql_parse_admin(st_select_lex * current_lex) {
1214 SQL_I_List<TABLE_LIST> table_list = current_lex->table_list;
1215 TABLE_ELEMENT = table_list.elements;
1216 TABLE_LIST *table_name = table_list.first;
1217
1218 if (TABLE_ELEMENT == 1) {
1219 if (is_not_tmp_table(table_name)){
1220 DRIVED_TABLE = table_name;
1221 table_name->is_table_driverd = true;
1222 }
1223 } else {
1224 List_iterator<TABLE_LIST> top_join_list(current_lex->top_join_list);
1225 TABLE_LIST *top_table;
1226 while ((top_table = top_join_list++)) {
1227 if (top_table->nested_join != NULL) {
1228 // find_join_elements(top_table);
1229 find_join_elements_new(top_table);
1230 } else {
1231 if (TABLE_DRIVERD.count(top_table) == 0) {
1232 TABLE_DRIVERD.insert(top_table);
1233 }
1234 }
1235 }
1236 if (!TABLE_DRIVERD.empty()) {
1237 final_table_drived();
1238 }
1239 }
1240 if (mysql_sql_parse_group()) {
1241 if (options.verbose)
1242 sql_print_information("第%d步:开始添加group by 字段 \n", STEP_CNT++);
1243 mysql_sql_parse_group_order_add(DRIVED_TABLE, current_lex->group_list);
1244 } else if (mysql_sql_parse_order()) {
1245 if (options.verbose)
1246 sql_print_information("第%d步:开始添加order by 字段 \n", STEP_CNT++);
1247 mysql_sql_parse_group_order_add(DRIVED_TABLE, current_lex->order_list);
1248 }
1249 if (TABLE_ELEMENT > 1 && DRIVED_TABLE)
1250 table_index_add_condition_field();
1251 print_index();
1252}
1253
1254static GOptionEntry entries[] = { { "defaults-file", 'f', 0,
1255 G_OPTION_ARG_STRING, &(options.configfile), "sqls file", NULL }, {

Callers 1

mainFunction · 0.85

Calls 11

is_not_tmp_tableFunction · 0.85
find_join_elements_newFunction · 0.85
final_table_drivedFunction · 0.85
mysql_sql_parse_groupFunction · 0.85
sql_print_informationFunction · 0.85
mysql_sql_parse_orderFunction · 0.85
print_indexFunction · 0.85
insertMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected