diff options
author | unknown <konstantin@mysql.com> | 2005-02-10 17:41:54 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-02-10 17:41:54 +0300 |
commit | a26ce94f7adf0fb992045dfdf9d9401a36a6c31c (patch) | |
tree | 224dc4a8c83b72b4b336a3b9892867b921d97505 /tests | |
parent | fca90750dfa0a2bee85a4824aba7c2197d45587c (diff) | |
download | mariadb-git-a26ce94f7adf0fb992045dfdf9d9401a36a6c31c.tar.gz |
A fix and test case for Bug#7990 "mysql_stmt_close doesn't
reset mysql->net.last_error": the solution is to clear
MYSQL->net error before performing COM_CLOSE: if the call
succeeds, the connection is usable for other statements.
More comprehensive fix is to clear MYSQL->net for all
recoverable errors at the time they happen, it will be
implemented in 5.0 as it introduces incompatibility in behavior.
libmysql/libmysql.c:
A simple fix for Bug#7990 "mysql_stmt_close doesn't reset
mysql->net.last_error"
tests/mysql_client_test.c:
A test case for Bug#7990 " mysql_stmt_close doesn't reset
mysql->net.last_error"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e4bdd1d350a..2c7a8fdb635 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11534,7 +11534,7 @@ static void test_bug6761(void) } -/* Bug#8330 - Bug #8330 mysql_stmt_execute crashes (libmysql) */ +/* Bug#8330 - mysql_stmt_execute crashes (libmysql) */ static void test_bug8330() { @@ -11585,6 +11585,26 @@ static void test_bug8330() } +/* Bug#7990 - mysql_stmt_close doesn't reset mysql->net.last_error */ + +static void test_bug7990() +{ + MYSQL_STMT *stmt; + int rc; + myheader("test_bug7990"); + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, "foo", 3); + /* + XXX: the fact that we store errno both in STMT and in + MYSQL is not documented and is subject to change in 5.0 + */ + DIE_UNLESS(rc && mysql_stmt_errno(stmt) && mysql_errno(mysql)); + mysql_stmt_close(stmt); + DIE_UNLESS(!mysql_errno(mysql)); +} + + /* Read and parse arguments and MySQL options from my.cnf */ |