#At file:///export/home/tmp/ss156133/z/53899-51/ based on revid:georgi.kodinov@stripped
3419 Staale Smedseng 2010-06-25
Bug #53899 Wrong mysql_stmt_errno() after connection loss with
[This is a recommit of last week's commit which was missing a bug
number in the commit message.]
A client with automatic reconnect enabled will see the error message
"Lost connection to MySQL server during query" if the connection is
lost between mysql_stmt_prepare() and mysql_stmt_execute(). The
mysql_stmt_errno() number, however, is 0 -- not the corresponding
This patch checks for the case where the prepared statement has been
pruned due to a connection loss (i.e., stmt->mysql has been set to
NULL) during a call to cli_advanced_command().
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2010-02-26 14:30:14 +0000
+++ b/libmysql/libmysql.c 2010-06-25 11:00:08 +0000
@@ -2495,7 +2495,13 @@ static my_bool execute(MYSQL_STMT *stmt,
- set_stmt_errmsg(stmt, net);
+ If stmt->mysql is cleared (i.e., server is lost while auto
+ reconnect is enabled), don't touch the stmt error as this was
+ already set in mysql_prune_stmt_list().
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
Attachment: [text/bzr-bundle] email@example.com
|• bzr commit into mysql-5.1-bugteam branch (staale.smedseng:3419) Bug#53899||Staale Smedseng||25 Jun|