List:Internals« Previous MessageNext Message »
From:konstantin Date:July 14 2005 4:53pm
Subject:bk commit into 4.1 tree (konstantin:1.2354) BUG#11183
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2354 05/07/14 18:53:26 konstantin@stripped +2 -0
  A fix and a test case for Bug#11183 "mysql_stmt_reset() doesn't reset
  information about error".

  tests/mysql_client_test.c
    1.153 05/07/14 18:53:15 konstantin@stripped +45 -0
    A test case for Bug#11183 "mysql_stmt_reset() doesn't reset information 
    about error"

  libmysql/libmysql.c
    1.296 05/07/14 18:53:15 konstantin@stripped +12 -0
    Clear the last error on the statement if mysql_stmt_reset succeeded.

# 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-4.1-root

--- 1.295/libmysql/libmysql.c	2005-05-14 17:28:51 +04:00
+++ 1.296/libmysql/libmysql.c	2005-07-14 18:53:15 +04:00
@@ -1834,6 +1834,17 @@
   }
 }
 
+
+static void stmt_clear_error(MYSQL_STMT *stmt)
+{
+  if (stmt->last_errno)
+  {
+    stmt->last_errno= 0;
+    stmt->last_error[0]= '\0';
+    strmov(stmt->sqlstate, not_error_sqlstate);
+  }
+}
+
 /*
   Set statement error code, sqlstate, and error message
   from given errcode and sqlstate.
@@ -4625,6 +4636,7 @@
        param < param_end;
        param++)
     param->long_data_used= 0;
+  stmt_clear_error(stmt);
 
   DBUG_RETURN(0);
 }

--- 1.152/tests/mysql_client_test.c	2005-07-14 15:13:18 +04:00
+++ 1.153/tests/mysql_client_test.c	2005-07-14 18:53:15 +04:00
@@ -11697,6 +11697,50 @@
   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 @@
   { "test_bug7990", test_bug7990 },
   { "test_bug8378", test_bug8378 },
   { "test_bug9735", test_bug9735 },
+  { "test_bug11183", test_bug11183 },
   { 0, 0 }
 };
 
Thread
bk commit into 4.1 tree (konstantin:1.2354) BUG#11183konstantin14 Jul