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

Function loc_advanced_command

sql/sql_prepare.cc:6375–6458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6373
6374
6375static my_bool
6376loc_advanced_command(MYSQL *mysql, enum enum_server_command command,
6377 const uchar *header, ulong header_length,
6378 const uchar *arg, ulong arg_length, my_bool skip_check,
6379 MYSQL_STMT *stmt)
6380{
6381 my_bool result= 1;
6382 Protocol_local *p= (Protocol_local *) mysql->thd;
6383 NET *net= &mysql->net;
6384
6385 if (p->thd && p->thd->killed != NOT_KILLED)
6386 {
6387 if (p->thd->killed < KILL_CONNECTION)
6388 p->thd->killed= NOT_KILLED;
6389 else
6390 return 1;
6391 }
6392
6393 p->clear_data_list();
6394 /* Check that we are calling the client functions in right order */
6395 if (mysql->status != MYSQL_STATUS_READY)
6396 {
6397 set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
6398 goto end;
6399 }
6400
6401 /* Clear result variables */
6402 p->thd->clear_error(1);
6403 mysql->affected_rows= ~(my_ulonglong) 0;
6404 mysql->field_count= 0;
6405 net_clear_error(net);
6406
6407 /*
6408 We have to call free_old_query before we start to fill mysql->fields
6409 for new query. In the case of embedded server we collect field data
6410 during query execution (not during data retrieval as it is in remote
6411 client). So we have to call free_old_query here
6412 */
6413 free_old_query(mysql);
6414
6415 if (header)
6416 {
6417 arg= header;
6418 arg_length= header_length;
6419 }
6420
6421 if (p->new_thd)
6422 {
6423 THD *thd_orig= current_thd;
6424 set_current_thd(p->thd);
6425 p->thd->thread_stack= (void*) &result; // Big stack
6426 p->thd->set_time();
6427 result= execute_server_code(p->thd, (const char *)arg, arg_length);
6428 p->thd->cleanup_after_query();
6429 mysql_audit_release(p->thd);
6430 p->end_statement();
6431 set_current_thd(thd_orig);
6432 }

Callers

nothing calls this directly

Calls 14

set_mysql_errorFunction · 0.85
net_clear_errorFunction · 0.85
free_old_queryFunction · 0.85
set_current_thdFunction · 0.85
execute_server_codeFunction · 0.85
mysql_audit_releaseFunction · 0.85
set_binlog_varsMethod · 0.80
execute_directMethod · 0.80
restore_binlog_varsMethod · 0.80
clear_data_listMethod · 0.45
clear_errorMethod · 0.45
set_timeMethod · 0.45

Tested by

no test coverage detected