summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.(none)>2007-10-31 18:33:13 +0300
committerunknown <kostja@bodhi.(none)>2007-10-31 18:33:13 +0300
commitfd820b6a55267ffb2843dab95163a544bf3729c5 (patch)
tree9e4c116001f7b8f6d21456125e302851b28a07c2 /sql/sql_class.cc
parentf033c6143d9e77ede6908b2161121ea79392a59c (diff)
downloadmariadb-git-fd820b6a55267ffb2843dab95163a544bf3729c5.tar.gz
Cleanup: rename select_send::status to select_send::is_result_set_started.
Add select_send::cleanup. Fix a compilation warning. Issues spotted while working on the fix for Bug#12713. sql-common/client.c: Fix a warning. sql/sql_class.cc: Give a variable a more specific name. Rewrite an incorrect comment. Add a cleanup for select_send. The only case now this cleanup can be necessary is when we have a prepared statement inside a stored procedure, and a continue handler. At first execution, the statement is killed after having executed select_send::send_fields. At the second execution it is killed after having executed select_send::send_fields. sql/sql_class.h: Rename a member. Add comments.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc30
1 files changed, 22 insertions, 8 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index b5a29783044..a904023cbff 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1305,23 +1305,26 @@ bool select_send::send_fields(List<Item> &list, uint flags)
{
bool res;
if (!(res= thd->protocol->send_fields(&list, flags)))
- status= 1;
+ is_result_set_started= 1;
return res;
}
void select_send::abort()
{
DBUG_ENTER("select_send::abort");
- if (status && thd->spcont &&
+ if (is_result_set_started && thd->spcont &&
thd->spcont->find_handler(thd, thd->net.last_errno,
MYSQL_ERROR::WARN_LEVEL_ERROR))
{
/*
- Executing stored procedure without a handler.
- Here we should actually send an error to the client,
- but as an error will break a multiple result set, the only thing we
- can do for now is to nicely end the current data set and remembering
- the error so that the calling routine will abort
+ We're executing a stored procedure, have an open result
+ set, an SQL exception conditiona and a handler for it.
+ In this situation we must abort the current statement,
+ silence the error and start executing the continue/exit
+ handler.
+ Before aborting the statement, let's end the open result set, as
+ otherwise the client will hang due to the violation of the
+ client/server protocol.
*/
thd->net.report_error= 0;
send_eof();
@@ -1331,6 +1334,17 @@ void select_send::abort()
}
+/**
+ Cleanup an instance of this class for re-use
+ at next execution of a prepared statement/
+ stored procedure statement.
+*/
+
+void select_send::cleanup()
+{
+ is_result_set_started= FALSE;
+}
+
/* Send data to client. Returns 0 if ok */
bool select_send::send_data(List<Item> &items)
@@ -1392,7 +1406,7 @@ bool select_send::send_eof()
if (! thd->is_error())
{
::send_eof(thd);
- status= 0;
+ is_result_set_started= 0;
return 0;
}
else