summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2005-10-17 15:07:47 +0200
committerunknown <pem@mysql.com>2005-10-17 15:07:47 +0200
commitc8a2ff6f533f91f9a56e8a12cba2965ebfadcc87 (patch)
treed16ca31453be37d53895be07584765b1337a6698 /sql
parentc41dc78dbce5a68729fd1a1558fb3ae07f0856ec (diff)
downloadmariadb-git-c8a2ff6f533f91f9a56e8a12cba2965ebfadcc87.tar.gz
Additional fix for BUG#7049, after review.
Make sure "select" aborts when finding a SP condition handler beyond the current scope. mysql-test/r/sp.result: Updated test results after fixing error handling in select. sql/mysqld.cc: Make sure "select" aborts when finding a SP condition handler beyond the current scope. sql/protocol.cc: Make sure "select" aborts when finding a SP condition handler beyond the current scope. sql/sp_rcontext.h: Added method for checking if the handler was found in the current context. sql/sql_error.cc: Make sure "select" aborts when finding a SP condition handler beyond the current scope.
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/protocol.cc4
-rw-r--r--sql/sp_rcontext.h7
-rw-r--r--sql/sql_error.cc2
4 files changed, 15 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5befcd6d503..0e3ca6a8c89 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2342,6 +2342,8 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
if (thd->spcont &&
thd->spcont->find_handler(error, MYSQL_ERROR::WARN_LEVEL_ERROR))
{
+ if (! thd->spcont->found_handler_here())
+ thd->net.report_error= 1; /* Make "select" abort correctly */
DBUG_RETURN(0);
}
diff --git a/sql/protocol.cc b/sql/protocol.cc
index ade94a483a8..8c3e5a62820 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -76,6 +76,8 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
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
@@ -181,6 +183,8 @@ net_printf_error(THD *thd, uint errcode, ...)
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
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index c7a298eccc0..cae5c5467c9 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -149,6 +149,13 @@ class sp_rcontext : public Sql_alloc
return m_handler[m_hfound].type;
}
+ // Returns true if we found a handler in this context
+ inline bool
+ found_handler_here()
+ {
+ return (m_hfound >= 0);
+ }
+
// Clears the handler find state
inline void
clear_handler()
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 2e262569386..191a6e0a1fd 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -144,6 +144,8 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
thd->really_abort_on_warning()) ?
MYSQL_ERROR::WARN_LEVEL_ERROR : level))
{
+ if (! thd->spcont->found_handler_here())
+ thd->net.report_error= 1; /* Make "select" abort correctly */
DBUG_RETURN(NULL);
}
query_cache_abort(&thd->net);