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

Function emb_advanced_command

libmysqld/lib_sql.cc:107–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107static my_bool
108emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
109 const uchar *header, ulong header_length,
110 const uchar *arg, ulong arg_length, my_bool skip_check,
111 MYSQL_STMT *stmt)
112{
113 my_bool result= 1;
114 THD *thd=(THD *) mysql->thd, *old_current_thd= current_thd;
115 NET *net= &mysql->net;
116 my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
117
118 if (thd && thd->killed != NOT_KILLED)
119 {
120 if (thd->killed < KILL_CONNECTION)
121 thd->killed= NOT_KILLED;
122 else
123 {
124 free_embedded_thd(mysql);
125 if (old_current_thd == thd)
126 old_current_thd= 0;
127 thd= 0;
128 }
129 }
130
131 if (!thd)
132 {
133 /* Do "reconnect" if possible */
134 if (mysql_reconnect(mysql) || stmt_skip)
135 return 1;
136 thd= (THD *) mysql->thd;
137 }
138
139 thd->clear_data_list();
140 /* Check that we are calling the client functions in right order */
141 if (mysql->status != MYSQL_STATUS_READY)
142 {
143 set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
144 result= 1;
145 goto end;
146 }
147
148 /* Clear result variables */
149 thd->clear_error(1);
150 mysql->affected_rows= ~(my_ulonglong) 0;
151 mysql->field_count= 0;
152 net_clear_error(net);
153 thd->current_stmt= stmt;
154
155 thd->thread_stack= (char*) &thd;
156 thd->store_globals(); // Fix if more than one connect
157 /*
158 We have to call free_old_query before we start to fill mysql->fields
159 for new query. In the case of embedded server we collect field data
160 during query execution (not during data retrieval as it is in remote
161 client). So we have to call free_old_query here
162 */
163 free_old_query(mysql);
164

Callers 1

emb_stmt_executeFunction · 0.85

Calls 10

free_embedded_thdFunction · 0.85
mysql_reconnectFunction · 0.85
set_mysql_errorFunction · 0.85
net_clear_errorFunction · 0.85
free_old_queryFunction · 0.85
clear_data_listMethod · 0.45
clear_errorMethod · 0.45
store_globalsMethod · 0.45
is_errorMethod · 0.45
reset_globalsMethod · 0.45

Tested by

no test coverage detected