summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2006-08-30 03:00:19 +0400
committerunknown <kostja@bodhi.local>2006-08-30 03:00:19 +0400
commit5fab3969af3d73abff00cb16c356c106698b97e1 (patch)
tree844b46ab5d82eec374f925e63be3812e697f87e3 /sql/protocol.cc
parent2592d4a1399bc1d5a05c8184c19fcddfa661e141 (diff)
parent4355ea5a38c819cf1e98089b3d85fc628c48da46 (diff)
downloadmariadb-git-5fab3969af3d73abff00cb16c356c106698b97e1.tar.gz
Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge BitKeeper/deleted/.del-im_check_os.inc: Auto merged BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833: Auto merged BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921: Auto merged BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048: Auto merged configure.in: Auto merged BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f: Auto merged include/mysql_com.h: Auto merged mysql-test/lib/mtr_io.pl: Auto merged mysql-test/r/im_daemon_life_cycle.result: Auto merged mysql-test/r/im_life_cycle.result: Auto merged mysql-test/r/im_utils.result: Auto merged mysql-test/r/sp-error.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/type_varchar.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/im_daemon_life_cycle.imtest: Auto merged mysql-test/t/im_life_cycle.imtest: Auto merged mysql-test/t/im_utils.imtest: Auto merged mysql-test/t/sp-error.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/type_varchar.test: Auto merged mysql-test/t/view.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_row.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/mysql_priv.h: Auto merged sql/net_serv.cc: Auto merged sql/protocol.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_trigger.h: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/mysql-test-run.pl: Use local. Alik will merge his changes manually. mysql-test/lib/mtr_process.pl: Use local. mysql-test/r/grant.result: Use local. mysql-test/r/sp.result: Use local. mysql-test/r/ps.result: Manual merge. mysql-test/t/grant.test: Manual merge. mysql-test/t/ps.test: Manual merge. mysql-test/t/sp.test: Manual merge. sql/Makefile.am: Manual merge. sql/field.cc: Manual merge. sql/mysqld.cc: Manual merge. sql/share/errmsg.txt: Manual merge. sql/sp.cc: Manual merge. sql/sp_head.h: Manual merge. sql/sql_trigger.cc: Manual merge. sql/sql_view.cc: Manual merge.
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc40
1 files changed, 25 insertions, 15 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 46d28a16c58..e00a70cf3a2 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -53,8 +53,18 @@ bool Protocol_prep::net_store_data(const char *from, uint length)
}
- /* Send a error string to client */
+/*
+ Send a error string to client
+
+ Design note:
+ net_printf_error and net_send_error are low-level functions
+ that shall be used only when a new connection is being
+ established or at server startup.
+ For SIGNAL/RESIGNAL and GET DIAGNOSTICS functionality it's
+ critical that every error that can be intercepted is issued in one
+ place only, my_message_sql.
+*/
void net_send_error(THD *thd, uint sql_errno, const char *err)
{
NET *net= &thd->net;
@@ -64,19 +74,15 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
err ? err : net->last_error[0] ?
net->last_error : "NULL"));
+ DBUG_ASSERT(!thd->spcont);
+
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))
- {
- if (! thd->spcont->found_handler_here())
- thd->net.report_error= 1; /* Make "select" abort correctly */
- DBUG_VOID_RETURN;
- }
+
thd->query_error= 1; // needed to catch query errors during replication
if (!err)
{
@@ -117,6 +123,15 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
Write error package and flush to client
It's a little too low level, but I don't want to use another buffer for
this
+
+ Design note:
+
+ net_printf_error and net_send_error are low-level functions
+ that shall be used only when a new connection is being
+ established or at server startup.
+ For SIGNAL/RESIGNAL and GET DIAGNOSTICS functionality it's
+ critical that every error that can be intercepted is issued in one
+ place only, my_message_sql.
*/
void
@@ -136,6 +151,8 @@ net_printf_error(THD *thd, uint errcode, ...)
DBUG_ENTER("net_printf_error");
DBUG_PRINT("enter",("message: %u",errcode));
+ DBUG_ASSERT(!thd->spcont);
+
if (net && net->no_send_error)
{
thd->clear_error();
@@ -143,13 +160,6 @@ net_printf_error(THD *thd, uint errcode, ...)
DBUG_VOID_RETURN;
}
- if (thd->spcont && thd->spcont->find_handler(errcode,
- MYSQL_ERROR::WARN_LEVEL_ERROR))
- {
- if (! thd->spcont->found_handler_here())
- thd->net.report_error= 1; /* Make "select" abort correctly */
- DBUG_VOID_RETURN;
- }
thd->query_error= 1; // needed to catch query errors during replication
#ifndef EMBEDDED_LIBRARY
query_cache_abort(net); // Safety