List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:November 20 2009 10:54pm
Subject:bzr commit into mysql-5.6-next-mr branch (kostja:2930) Bug#36004
View as plain text  
#At file:///opt/local/work/next-mr-kostja/ based on revid:kostja@stripped

 2930 Konstantin Osipov	2009-11-21
      Backport of:
      ------------------------------------------------------------
      revno: 2597.42.4
      committer: davi@stripped/endora.local
      timestamp: Tue 2008-04-15 17:29:42 -0300
      message:
      Bug#36004 mysql_stmt_prepare resets the list of warnings
      
      Although the manual says that "the list of messages is reset
      for each new statement that uses a table", the list of messages
      is being unconditionally reset for prepare commands.
      
      The solution is to enforce that the prepare command will only
      reset the message list if the statement being prepared uses
      a table or a warning is pushed.
     @ tests/mysql_client_test.c
        Add test case for Bug#36004

    modified:
      tests/mysql_client_test.c
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2009-11-06 14:20:27 +0000
+++ b/tests/mysql_client_test.c	2009-11-20 22:53:50 +0000
@@ -18392,9 +18392,51 @@ static void test_wl4166_4()
 }
 
 /**
-  Bug#38486 Crash when using cursor protocol
+  Bug#36004 mysql_stmt_prepare resets the list of warnings
 */
 
+static void test_bug36004()
+{
+  int rc, warning_count= 0;
+  MYSQL_STMT *stmt;
+
+  DBUG_ENTER("test_bug36004");
+  myheader("test_bug36004");
+
+  rc= mysql_query(mysql, "drop table if exists inexistant");
+  myquery(rc);
+
+  DIE_UNLESS(mysql_warning_count(mysql) == 1);
+  query_int_variable(mysql, "@@warning_count", &warning_count);
+  DIE_UNLESS(warning_count);
+
+  stmt= mysql_simple_prepare(mysql, "select 1");
+  check_stmt(stmt);
+
+  DIE_UNLESS(mysql_warning_count(mysql) == 0);
+  query_int_variable(mysql, "@@warning_count", &warning_count);
+  DIE_UNLESS(warning_count);
+
+  rc= mysql_stmt_execute(stmt);
+  check_execute(stmt, rc);
+
+  DIE_UNLESS(mysql_warning_count(mysql) == 0);
+  mysql_stmt_close(stmt);
+
+  query_int_variable(mysql, "@@warning_count", &warning_count);
+  DIE_UNLESS(warning_count);
+
+  stmt= mysql_simple_prepare(mysql, "drop table if exists inexistant");
+  check_stmt(stmt);
+
+  query_int_variable(mysql, "@@warning_count", &warning_count);
+  DIE_UNLESS(warning_count == 0);
+  mysql_stmt_close(stmt);
+
+  DBUG_VOID_RETURN;
+}
+
+
 static void test_bug38486(void)
 {
   MYSQL_STMT *stmt;
@@ -19154,6 +19196,7 @@ static struct my_tests_st my_tests[]= {
   { "test_wl4166_2", test_wl4166_2 },
   { "test_wl4166_3", test_wl4166_3 },
   { "test_wl4166_4", test_wl4166_4 },
+  { "test_bug36004", test_bug36004 },
   { "test_wl4435",   test_wl4435 },
   { "test_wl4435_2", test_wl4435_2 },
   { "test_bug38486", test_bug38486 },


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20091120225350-1y7lu75nbpmle4jv.bundle
Thread
bzr commit into mysql-5.6-next-mr branch (kostja:2930) Bug#36004Konstantin Osipov20 Nov