summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorTatjana Azundris Nuernberg <tatjana.nuernberg@oracle.com>2012-01-02 06:50:05 +0000
committerTatjana Azundris Nuernberg <tatjana.nuernberg@oracle.com>2012-01-02 06:50:05 +0000
commited1ba992c1d3c3ecbe6a2769c51ceb5d27606d3b (patch)
tree0aab7b4c9b85d988c5695333173c9c4de6c7ab98 /sql/sql_connect.cc
parentcb80ad09da1571b6ecf3668ced4f0272d9ef0167 (diff)
parent251fa88afacbd03a00894c04037d987b62f3ca58 (diff)
downloadmariadb-git-ed1ba992c1d3c3ecbe6a2769c51ceb5d27606d3b.tar.gz
manual up-merge of Bug#11755281
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index e96d0e818c7..e08303dcb51 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -668,13 +668,38 @@ void prepare_new_connection_state(THD* thd)
execute_init_command(thd, &opt_init_connect, &LOCK_sys_init_connect);
if (thd->is_error())
{
- thd->killed= THD::KILL_CONNECTION;
+ ulong packet_length;
+ NET *net= &thd->net;
+
sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
- thd->thread_id,(thd->db ? thd->db : "unconnected"),
+ thd->thread_id,
+ thd->db ? thd->db : "unconnected",
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, "init_connect command failed");
sql_print_warning("%s", thd->stmt_da->message());
+
+ thd->lex->current_select= 0;
+ my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
+ thd->clear_error();
+ net_new_transaction(net);
+ packet_length= my_net_read(net);
+ /*
+ If my_net_read() failed, my_error() has been already called,
+ and the main Diagnostics Area contains an error condition.
+ */
+ if (packet_length != packet_error)
+ my_error(ER_NEW_ABORTING_CONNECTION, MYF(0),
+ thd->thread_id,
+ thd->db ? thd->db : "unconnected",
+ sctx->user ? sctx->user : "unauthenticated",
+ sctx->host_or_ip, "init_connect command failed");
+
+ thd->server_status&= ~SERVER_STATUS_CLEAR_SET;
+ thd->protocol->end_statement();
+ thd->killed = THD::KILL_CONNECTION;
+ return;
}
+
thd->proc_info=0;
thd->set_time();
thd->init_for_queries();