summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@quad.opbmk>2008-03-18 13:51:17 +0300
committerunknown <anozdrin/alik@quad.opbmk>2008-03-18 13:51:17 +0300
commit07db330a55e54e59490b9e46faeade789a52d835 (patch)
treee96aaaaa6d8f3413c11e63aee2802003dfc5b2bc /libmysql
parent269ebe54211cf96c4e64fa7268a1414588ca1de8 (diff)
parent809522598a9a8946a5e1fa4a981717c38466a379 (diff)
downloadmariadb-git-07db330a55e54e59490b9e46faeade789a52d835.tar.gz
Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged libmysql/libmysql.c: Auto merged sql-common/client.c: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged tests/mysql_client_test.c: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 13ccd5749a3..15be5e34dff 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2467,7 +2467,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
int4store(buff+5, 1); /* iteration count */
res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
- (uchar*) packet, length, 1, NULL) ||
+ (uchar*) packet, length, 1, stmt) ||
(*mysql->methods->read_query_result)(mysql));
stmt->affected_rows= mysql->affected_rows;
stmt->server_status= mysql->server_status;
@@ -2683,7 +2683,7 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
buff, sizeof(buff), (uchar*) 0, 0,
- 1, NULL))
+ 1, stmt))
{
set_stmt_errmsg(stmt, net);
return 1;
@@ -3350,7 +3350,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
*/
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA,
buff, sizeof(buff), (uchar*) data,
- length, 1, NULL))
+ length, 1, stmt))
{
set_stmt_errmsg(stmt, &mysql->net);
DBUG_RETURN(1);
@@ -4748,6 +4748,13 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
MYSQL_DATA *result= &stmt->result;
DBUG_ENTER("mysql_stmt_store_result");
+ if (!mysql)
+ {
+ /* mysql can be reset in mysql_close called from mysql_reconnect */
+ set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL);
+ DBUG_RETURN(1);
+ }
+
mysql= mysql->last_used_con;
if (!stmt->field_count)
@@ -4773,7 +4780,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
int4store(buff, stmt->stmt_id);
int4store(buff + 4, (int)~0); /* number of rows to fetch */
if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
- (uchar*) 0, 0, 1, NULL))
+ (uchar*) 0, 0, 1, stmt))
{
set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
@@ -4960,7 +4967,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
uchar buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */
int4store(buff, stmt->stmt_id);
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff,
- sizeof(buff), 0, 0, 0, NULL))
+ sizeof(buff), 0, 0, 0, stmt))
{
set_stmt_errmsg(stmt, &mysql->net);
stmt->state= MYSQL_STMT_INIT_DONE;