summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-07-14 20:02:33 +0400
committerunknown <konstantin@mysql.com>2005-07-14 20:02:33 +0400
commitbd44c99b853c07761554214f57c2a0700804ffc3 (patch)
treeaac1f0563c4cb7598f9f497b6d3a8cfc33f6388a /tests
parent69ecbbcbf31aeb5165c9134d8fa1180f42d91da1 (diff)
downloadmariadb-git-bd44c99b853c07761554214f57c2a0700804ffc3.tar.gz
A fix and a test case for Bug#11183 "mysql_stmt_reset() doesn't reset
information about error". libmysql/libmysql.c: Clear the last error on the statement if mysql_stmt_reset succeeded. tests/mysql_client_test.c: A test case for Bug#11183 "mysql_stmt_reset() doesn't reset information about error"
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index f874276a656..b7398494deb 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -11697,6 +11697,50 @@ static void test_bug9735()
myquery(rc);
}
+/* Bug#11183 "mysql_stmt_reset() doesn't reset information about error" */
+
+static void test_bug11183()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ char bug_statement[]= "insert into t1 values (1)";
+
+ myheader("test_bug11183");
+
+ mysql_query(mysql, "drop table t1 if exists");
+ mysql_query(mysql, "create table t1 (a int)");
+
+ stmt= mysql_stmt_init(mysql);
+ DIE_UNLESS(stmt != 0);
+
+ rc= mysql_stmt_prepare(stmt, bug_statement, strlen(bug_statement));
+ check_execute(stmt, rc);
+
+ rc= mysql_query(mysql, "drop table t1");
+ myquery(rc);
+
+ /* Trying to execute statement that should fail on execute stage */
+ rc= mysql_stmt_execute(stmt);
+ DIE_UNLESS(rc);
+
+ mysql_stmt_reset(stmt);
+ DIE_UNLESS(mysql_stmt_errno(stmt) == 0);
+
+ mysql_query(mysql, "create table t1 (a int)");
+
+ /* Trying to execute statement that should pass ok */
+ if (mysql_stmt_execute(stmt))
+ {
+ mysql_stmt_reset(stmt);
+ DIE_UNLESS(mysql_stmt_errno(stmt) == 0);
+ }
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "drop table t1");
+ myquery(rc);
+}
+
/*
Read and parse arguments and MySQL options from my.cnf
@@ -11913,6 +11957,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug7990", test_bug7990 },
{ "test_bug8378", test_bug8378 },
{ "test_bug9735", test_bug9735 },
+ { "test_bug11183", test_bug11183 },
{ 0, 0 }
};