summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-12-06 15:50:03 -0800
committerunknown <jimw@mysql.com>2005-12-06 15:50:03 -0800
commit4ea36b7a17c05d8fce35c7594930559d8e9c2f7a (patch)
tree372274c153c285b5eaef5b85f3447d2e160bc7dc /tests
parent3d1e9eae43a2cd353278b18da37c0ab28d88357d (diff)
downloadmariadb-git-4ea36b7a17c05d8fce35c7594930559d8e9c2f7a.tar.gz
Fix value returned by mysql_warning_count() after fetching a prepared
statement that generated a warning. (Bug #15510) sql-common/client.c: Reset warning_count in free_old_query(), don't stomp old value for it in cli_read_query_result(). tests/mysql_client_test.c: Add new regression test
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index ce732690700..f794ac893ae 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -14590,6 +14590,40 @@ static void test_bug14845()
myquery(rc);
}
+
+/*
+ Bug #15510: mysql_warning_count returns 0 after mysql_stmt_fetch which
+ should warn
+*/
+static void test_bug15510()
+{
+ MYSQL_STMT *stmt;
+ MYSQL_RES *res;
+ int rc;
+ const char *query= "select 1 from dual where 1/0";
+
+ myheader("test_bug15510");
+
+ rc= mysql_query(mysql, "set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO'");
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+
+ rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_fetch(stmt);
+ DIE_UNLESS(mysql_warning_count(mysql));
+
+ /* Cleanup */
+ mysql_stmt_close(stmt);
+ rc= mysql_query(mysql, "set @@sql_mode=''");
+ myquery(rc);
+}
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -14849,6 +14883,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug13488", test_bug13488 },
{ "test_bug13524", test_bug13524 },
{ "test_bug14845", test_bug14845 },
+ { "test_bug15510", test_bug15510},
{ 0, 0 }
};