diff options
author | kostja@bodhi.local <> | 2006-07-24 14:56:53 +0400 |
---|---|---|
committer | kostja@bodhi.local <> | 2006-07-24 14:56:53 +0400 |
commit | 2ce1a07c89f449e734a76853a03333e59e304976 (patch) | |
tree | 9e665cae0cf874da93929345fdbe6d3d6d97debb /include/sql_common.h | |
parent | afb31714c513e40834cdf991420a6867047abb01 (diff) | |
download | mariadb-git-2ce1a07c89f449e734a76853a03333e59e304976.tar.gz |
A fix and a test case for Bug#15752 "Lost connection to MySQL server
when calling a SP from C API"
The bug was caused by lack of checks for misuse in mysql_real_query.
A stored procedure always returns at least one result, which is the
status of execution of the procedure itself.
This result, or so-called OK packet, is similar to a result
returned by INSERT/UPDATE/CREATE operations: it contains the overall
status of execution, the number of affected rows and the number of
warnings. The client test program attached to the bug did not read this
result and ivnoked the next query. In turn, libmysql had no check for
such scenario and mysql_real_query was simply trying to send that query
without reading the pending response, thus messing up the communication
protocol.
The fix is to return an error from mysql_real_query when it's called
prior to retrieval of all pending results.
Diffstat (limited to 'include/sql_common.h')
-rw-r--r-- | include/sql_common.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sql_common.h b/include/sql_common.h index 9fc8d4f457b..c77a905aeb1 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -35,7 +35,7 @@ my_bool cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const char *header, ulong header_length, const char *arg, ulong arg_length, my_bool skip_check); - +unsigned long cli_safe_read(MYSQL *mysql); void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode, const char *sqlstate); void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate); |