summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorDmitry Shulga <Dmitry.Shulga@Sun.COM>2010-09-07 14:18:01 +0700
committerDmitry Shulga <Dmitry.Shulga@Sun.COM>2010-09-07 14:18:01 +0700
commitd2d4fdb23f6b38ff6718a35120043627582ee836 (patch)
treedc3f19abb33beae12725faec85458b8ee8cfe28b /libmysql
parent64b639260ca83c27a7ffaa0f4d12dcf167c580cf (diff)
downloadmariadb-git-d2d4fdb23f6b38ff6718a35120043627582ee836.tar.gz
Fixed bug #47485 - mysql_store_result returns a not NULL result set
for a prepared statement. include/mysql.h: enumerator MYSQL_STATUS_STATEMENT_GET_RESULT was added into mysql_status enum. include/mysql.h.pp: enumerator MYSQL_STATUS_STATEMENT_GET_RESULT was added into mysql_status enum. libmysql/libmysql.c: Introduce a separate mysql state to distinguish the situation when we have a binary result set pending on the server from the situation when the result set is in text protocol. execute() modified: if mysql->status == MYSQL_STATUS_GET_RESULT before return then set it to value MYSQL_STATUS_STATEMENT_GET_RESULT. stmt_read_row_unbuffered() and mysql_stmt_store_result() were modified: added checking for mysql->status against MYSQL_STATUS_STATEMENT_GET_RESULT value instead of MYSQL_STATUS_GET_RESULT. tests/mysql_client_test.c: added test_bug47485()
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 362ad5de6c4..8c612b6894e 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2503,6 +2503,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
}
+ else if (mysql->status == MYSQL_STATUS_GET_RESULT)
+ stmt->mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT;
DBUG_RETURN(0);
}
@@ -2641,7 +2643,7 @@ static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row)
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL);
return 1;
}
- if (mysql->status != MYSQL_STATUS_GET_RESULT)
+ if (mysql->status != MYSQL_STATUS_STATEMENT_GET_RESULT)
{
set_stmt_error(stmt, stmt->unbuffered_fetch_cancelled ?
CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC,
@@ -4847,7 +4849,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
}
- else if (mysql->status != MYSQL_STATUS_GET_RESULT)
+ else if (mysql->status != MYSQL_STATUS_STATEMENT_GET_RESULT)
{
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL);
DBUG_RETURN(1);