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

Function net_send_error

sql/protocol.cc:145–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143*/
144
145bool net_send_error(THD *thd, uint sql_errno, const char *err,
146 const char* sqlstate)
147{
148 bool error;
149 DBUG_ENTER("net_send_error");
150
151 DBUG_ASSERT(sql_errno);
152 DBUG_ASSERT(err);
153
154 DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, err));
155
156 if (sqlstate == NULL)
157 sqlstate= mysql_errno_to_sqlstate(sql_errno);
158
159 /*
160 It's one case when we can push an error even though there
161 is an OK or EOF already.
162 */
163 thd->get_stmt_da()->set_overwrite_status(true);
164
165 /* Abort multi-result sets */
166 thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
167
168 error= net_send_error_packet(thd, sql_errno, err, sqlstate);
169
170 thd->get_stmt_da()->set_overwrite_status(false);
171
172 DBUG_RETURN(error);
173}
174
175/**
176 Return ok to the client.

Callers

nothing calls this directly

Calls 4

mysql_errno_to_sqlstateFunction · 0.85
net_send_error_packetFunction · 0.85
set_overwrite_statusMethod · 0.80
get_stmt_daMethod · 0.80

Tested by

no test coverage detected