diff options
author | hf@deer.(none) <> | 2004-02-10 17:09:59 +0400 |
---|---|---|
committer | hf@deer.(none) <> | 2004-02-10 17:09:59 +0400 |
commit | 348bd98e4893f7e16bd5608a51d9911d17af2a03 (patch) | |
tree | 440516e57c4db729a22c4d8e8ccd54babc9dc6f0 /libmysql | |
parent | d200443bed85b2647da0729904a2e2d9449e16a8 (diff) | |
download | mariadb-git-348bd98e4893f7e16bd5608a51d9911d17af2a03.tar.gz |
Fix for #2208 (multi-query returns wrong result in embedded library)
now we execute only one first select during mysql_real_query
others - during 'mysql_next_result'
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/client_settings.h | 1 | ||||
-rw-r--r-- | libmysql/libmysql.c | 25 |
2 files changed, 17 insertions, 9 deletions
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index b1a85f567f9..6a7da0bcc81 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -58,6 +58,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt); MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt); int cli_unbuffered_fetch(MYSQL *mysql, char **row); const char * cli_read_statistic(MYSQL *mysql); +int cli_next_result(MYSQL *mysql); #ifdef EMBEDDED_LIBRARY int init_embedded_server(int argc, char **argv, char **groups); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 977657f8998..a3e88ccd03d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3511,6 +3511,21 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql) Reads and returns the next query results */ +int cli_next_result(MYSQL *mysql) +{ + DBUG_ENTER("cli_next_result"); + + mysql->net.last_error[0]= 0; + mysql->net.last_errno= 0; + strmov(mysql->net.sqlstate, not_error_sqlstate); + mysql->affected_rows= ~(my_ulonglong) 0; + + if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) + DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); + + DBUG_RETURN(-1); /* No more results */ +} + int STDCALL mysql_next_result(MYSQL *mysql) { DBUG_ENTER("mysql_next_result"); @@ -3523,15 +3538,7 @@ int STDCALL mysql_next_result(MYSQL *mysql) DBUG_RETURN(1); } - mysql->net.last_error[0]= 0; - mysql->net.last_errno= 0; - strmov(mysql->net.sqlstate, not_error_sqlstate); - mysql->affected_rows= ~(my_ulonglong) 0; - - if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) - DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); - - DBUG_RETURN(-1); /* No more results */ + DBUG_RETURN((*mysql->methods->next_result)(mysql)); } |