List:Internals« Previous MessageNext Message »
From:konstantin Date:June 19 2005 3:31pm
Subject:bk commit into 5.0 tree (konstantin:1.1956) BUG#9992
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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.1956 05/06/19 17:31:20 konstantin@stripped +1 -0
  Rewrite the test for Bug#9992.

  tests/mysql_client_test.c
    1.127 05/06/19 17:31:14 konstantin@stripped +55 -21
    Rewrite the test for Bug#9992.

# 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:	konstantin
# Host:	dragonfly.local
# Root:	/opt/local/work/mysql-5.0-root

--- 1.126/tests/mysql_client_test.c	2005-06-19 17:02:25 +04:00
+++ 1.127/tests/mysql_client_test.c	2005-06-19 17:31:14 +04:00
@@ -13266,6 +13266,59 @@
   myquery(rc);
 }
 
+
+/*
+  Check that mysql_next_result works properly in case when one of
+  the statements used in a multi-statement query is erroneous
+*/
+
+static void test_bug9992()
+{
+  MYSQL *mysql1;
+  MYSQL_RES* res ;
+  int   rc;
+
+  myheader("test_bug9992");
+
+  if (!opt_silent)
+    printf("Establishing a connection with option CLIENT_MULTI_STATEMENTS..\n");
+
+  mysql1= mysql_init(NULL);
+
+  if (!mysql_real_connect(mysql1, opt_host, opt_user, opt_password,
+                          opt_db ? opt_db : "test", opt_port, opt_unix_socket,
+                          CLIENT_MULTI_STATEMENTS))
+  {
+    fprintf(stderr, "Failed to connect to the database\n");
+    DIE_UNLESS(0);
+  }
+
+
+  /* Sic: SHOW DATABASE is incorrect syntax. */
+  rc= mysql_query(mysql1, "SHOW TABLES; SHOW DATABASE; SELECT 1;");
+
+  if (rc)
+  {
+    fprintf(stderr, "[%d] %s\n", mysql_errno(mysql1), mysql_error(mysql1));
+    DIE_UNLESS(0);
+  }
+
+  if (!opt_silent)
+    printf("Testing mysql_store_result/mysql_next_result..\n");
+
+  res= mysql_store_result(mysql1);
+  DIE_UNLESS(res);
+  mysql_free_result(res);
+  rc= mysql_next_result(mysql1);
+  DIE_UNLESS(rc == 1);                         /* Got errors, as expected */
+
+  if (!opt_silent)
+    fprintf(stdout, "Got error, sa expected:\n [%d] %s\n",
+            mysql_errno(mysql1), mysql_error(mysql1));
+
+  mysql_close(mysql1);
+}
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -13500,6 +13553,7 @@
   { "test_bug9643", test_bug9643 },
   { "test_bug10729", test_bug10729 },
   { "test_bug11111", test_bug11111 },
+  { "test_bug9992", test_bug9992 },
   { 0, 0 }
 };
 
@@ -13604,23 +13658,6 @@
   }
 }
 
-
-static void check_mupltiquery_bug9992()
-{
-
-  MYSQL_RES* res ;
-  mysql_query(mysql,"SHOW TABLES;SHOW DATABASE;SELECT 1;");
-  
-  fprintf(stdout, "\n\n!!! check_mupltiquery_bug9992 !!!\n");
-  do
-  {
-    if (!(res= mysql_store_result(mysql)))
-      return;
-    mysql_free_result(res);
-  } while (!mysql_next_result(mysql));
-  fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
-  return;
-}
 /***************************************************************************
   main routine
 ***************************************************************************/
@@ -13686,10 +13723,7 @@
   }
 
   client_disconnect();    /* disconnect from server */
-  
-  client_connect(CLIENT_MULTI_STATEMENTS);
-  check_mupltiquery_bug9992();
-  client_disconnect(); 
+
   free_defaults(defaults_argv);
   print_test_output();
 
Thread
bk commit into 5.0 tree (konstantin:1.1956) BUG#9992konstantin19 Jun