From 7a528488915786f56ab48e2995fae18cc9731d1a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Jan 2005 10:41:37 +0200 Subject: Fixed problem of sending ERROR to client after OK or EOF (BUG#6804) include/mysql_com.h: Flag which prevent sending error after EOF or OK sent mysql-test/r/kill.result: test of blocking of sending ERROR after OK or EOF mysql-test/t/kill.test: test of blocking of sending ERROR after OK or EOF sql/item_func.cc: typo fixed sql/net_serv.cc: initialization of flag sql/protocol.cc: check and set of flag no_send_error sql/sql_parse.cc: droping flag no_send_error before new command/query execution --- sql/protocol.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sql/protocol.cc') diff --git a/sql/protocol.cc b/sql/protocol.cc index d537f9cf829..c61a3eb9f7c 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -65,6 +65,12 @@ void net_send_error(THD *thd, uint sql_errno, const char *err) err ? err : net->last_error[0] ? net->last_error : "NULL")); + if (net && net->no_send_error) + { + thd->clear_error(); + DBUG_PRINT("info", ("sending error messages prohibited")); + DBUG_VOID_RETURN; + } if (thd->spcont && thd->spcont->find_handler(sql_errno, MYSQL_ERROR::WARN_LEVEL_ERROR)) { @@ -154,6 +160,13 @@ net_printf_error(THD *thd, uint errcode, ...) DBUG_ENTER("net_printf_error"); DBUG_PRINT("enter",("message: %u",errcode)); + if (net && net->no_send_error) + { + thd->clear_error(); + DBUG_PRINT("info", ("sending error messages prohibited")); + DBUG_VOID_RETURN; + } + if (thd->spcont && thd->spcont->find_handler(errcode, MYSQL_ERROR::WARN_LEVEL_ERROR)) { @@ -300,6 +313,9 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message) VOID(net_flush(net)); /* We can't anymore send an error to the client */ thd->net.report_error= 0; + thd->net.no_send_error= 1; + DBUG_PRINT("info", ("OK sent, so no more error sendong allowed")); + DBUG_VOID_RETURN; } @@ -357,6 +373,8 @@ send_eof(THD *thd, bool no_flush) if (!no_flush) VOID(net_flush(net)); } + thd->net.no_send_error= 1; + DBUG_PRINT("info", ("EOF sent, so no more error sendong allowed")); } DBUG_VOID_RETURN; } -- cgit v1.2.1