From: Date: December 7 2005 12:50am Subject: bk commit into 5.0 tree (jimw:1.1983) BUG#15510 List-Archive: http://lists.mysql.com/internals/33105 X-Bug: 15510 Message-Id: <20051206235008.880FCA83FD@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 5.0 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1983 05/12/06 15:50:03 jimw@stripped +2 -0 Fix value returned by mysql_warning_count() after fetching a prepared statement that generated a warning. (Bug #15510) tests/mysql_client_test.c 1.166 05/12/06 15:49:59 jimw@stripped +35 -0 Add new regression test sql-common/client.c 1.81 05/12/06 15:49:58 jimw@stripped +1 -1 Reset warning_count in free_old_query(), don't stomp old value for it in cli_read_query_result(). # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-5.0-15510 --- 1.80/sql-common/client.c 2005-11-25 02:57:07 -08:00 +++ 1.81/sql-common/client.c 2005-12-06 15:49:58 -08:00 @@ -715,6 +715,7 @@ init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */ mysql->fields= 0; mysql->field_count= 0; /* For API */ + mysql->warning_count= 0; mysql->info= 0; DBUG_VOID_RETURN; } @@ -2484,7 +2485,6 @@ DBUG_RETURN(1); mysql->status= MYSQL_STATUS_GET_RESULT; mysql->field_count= (uint) field_count; - mysql->warning_count= 0; DBUG_PRINT("exit",("ok")); DBUG_RETURN(0); } --- 1.165/tests/mysql_client_test.c 2005-11-18 06:55:45 -08:00 +++ 1.166/tests/mysql_client_test.c 2005-12-06 15:49:59 -08:00 @@ -14590,6 +14590,40 @@ 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 @@ { "test_bug13488", test_bug13488 }, { "test_bug13524", test_bug13524 }, { "test_bug14845", test_bug14845 }, + { "test_bug15510", test_bug15510}, { 0, 0 } };