summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-03-24 15:12:53 +0300
committerunknown <konstantin@mysql.com>2005-03-24 15:12:53 +0300
commit3b236b1dfd1fdc34548e296dc63e75735becd61d (patch)
treeec4df54ab1b5ce7db1d531ed35940a9f42ceecd6 /libmysql
parent648d40ea663aecb584c832380a4309a127d7c2a5 (diff)
downloadmariadb-git-3b236b1dfd1fdc34548e296dc63e75735becd61d.tar.gz
Fixes and test cases for Bug#8880 "Commands out of sync error with cursors"
and Bug#9159 "Server crash during mysql_stmt_close". The patch adds support for single-row result sets in cursors. libmysql/libmysql.c: If we wanted a cursor, and the server wasn't able to create one, buffer all rows on client. Currently this is possible only for single row result sets and some SHOW commands. sql/sql_prepare.cc: Properly free resources if there was a request to open a cursor which wasn't fullfilled. Give error on attempt to open a cursor for a statement not returning a result set. sql/sql_select.h: Initialize Item_arena of Cursor object. A case when a cursor object is created but not used is possible with single-row result sets. tests/mysql_client_test.c: Test cases for Bug#8880 and Bug#9159
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 9746cb222fa..47a15dd3fe3 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2862,6 +2862,17 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
mysql->status= MYSQL_STATUS_READY;
stmt->read_row_func= stmt_read_row_from_cursor;
}
+ else if (stmt->flags & CURSOR_TYPE_READ_ONLY)
+ {
+ /*
+ This is a single-row result set, a result set with no rows, EXPLAIN,
+ SHOW VARIABLES, or some other command which either a) bypasses the
+ cursors framework in the server and writes rows directly to the
+ network or b) is more efficient if all (few) result set rows are
+ precached on client and server's resources are freed.
+ */
+ DBUG_RETURN(mysql_stmt_store_result(stmt));
+ }
else
{
stmt->mysql->unbuffered_fetch_owner= &stmt->unbuffered_fetch_cancelled;