| 4046 | */ |
| 4047 | |
| 4048 | static bool execute_server_code(THD *thd, |
| 4049 | const char *sql_text, size_t sql_len) |
| 4050 | { |
| 4051 | PSI_statement_locker *parent_locker; |
| 4052 | Reprepare_observer *reprepare_observer; |
| 4053 | bool error; |
| 4054 | query_id_t save_query_id= thd->query_id; |
| 4055 | query_id_t next_id= next_query_id(); |
| 4056 | |
| 4057 | if (alloc_query(thd, sql_text, sql_len)) |
| 4058 | return TRUE; |
| 4059 | |
| 4060 | Parser_state parser_state; |
| 4061 | if (parser_state.init(thd, thd->query(), thd->query_length())) |
| 4062 | return TRUE; |
| 4063 | |
| 4064 | thd->query_id= next_id; |
| 4065 | parser_state.m_lip.multi_statements= FALSE; |
| 4066 | lex_start(thd); |
| 4067 | |
| 4068 | error= parse_sql(thd, &parser_state, NULL) || thd->is_error(); |
| 4069 | |
| 4070 | if (unlikely(error)) |
| 4071 | goto end; |
| 4072 | |
| 4073 | thd->lex->set_trg_event_type_for_tables(); |
| 4074 | |
| 4075 | parent_locker= thd->m_statement_psi; |
| 4076 | thd->m_statement_psi= NULL; |
| 4077 | reprepare_observer= thd->m_reprepare_observer; |
| 4078 | thd->m_reprepare_observer= NULL; |
| 4079 | error= mysql_execute_command(thd); |
| 4080 | thd->m_statement_psi= parent_locker; |
| 4081 | thd->m_reprepare_observer= reprepare_observer; |
| 4082 | |
| 4083 | /* report error issued during command execution */ |
| 4084 | if (likely(error == 0) && thd->spcont == NULL) |
| 4085 | general_log_write(thd, COM_QUERY, thd->query(), thd->query_length()); |
| 4086 | |
| 4087 | end: |
| 4088 | thd->lex->restore_set_statement_var(); |
| 4089 | thd->query_id= save_query_id; |
| 4090 | delete_explain_query(thd->lex); |
| 4091 | |
| 4092 | lex_end(thd->lex); |
| 4093 | |
| 4094 | return error; |
| 4095 | } |
| 4096 | |
| 4097 | |
| 4098 | bool Execute_sql_statement::execute_server_code(THD *thd) |
no test coverage detected