List:Internals« Previous MessageNext Message »
From:konstantin Date:November 17 2005 1:20pm
Subject:bk commit into 5.0 tree (konstantin:1.1967) BUG#13524
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.1967 05/11/17 16:20:12 konstantin@stripped +2 -0
  A fix and a test case for Bug#13524 "lock timeout gives 
  incorrect warning on open cursor"

  tests/mysql_client_test.c
    1.164 05/11/17 16:20:01 konstantin@stripped +62 -1
    A test case for Bug#13524 "lock timeout gives incorrect 
    warning on open cursor"

  sql/sql_prepare.cc
    1.164 05/11/17 16:20:00 konstantin@stripped +1 -0
    A fix for Bug#13524 "lock timeout gives incorrect 
    warning on open cursor": reset the connection for next
    command before performing a cursor fetch (add an omitted line).

# 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-13524

--- 1.163/sql/sql_prepare.cc	2005-11-03 16:21:19 +03:00
+++ 1.164/sql/sql_prepare.cc	2005-11-17 16:20:00 +03:00
@@ -2312,6 +2312,7 @@
   Server_side_cursor *cursor;
   DBUG_ENTER("mysql_stmt_fetch");
 
+  mysql_reset_thd_for_next_command(thd);
   statistic_increment(thd->status_var.com_stmt_fetch, &LOCK_status);
   if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch")))
     DBUG_VOID_RETURN;

--- 1.163/tests/mysql_client_test.c	2005-11-09 20:30:55 +03:00
+++ 1.164/tests/mysql_client_test.c	2005-11-17 16:20:01 +03:00
@@ -14419,7 +14419,7 @@
   myquery(rc);
 }
 
-/* Bug#13488 */
+/* Bug#13488: wrong column metadata when fetching from cursor */
 
 static void test_bug13488()
 {
@@ -14488,6 +14488,66 @@
 }
 
 /*
+  Bug#13524: warnings of a previous command are not reset when fetching
+  from a cursor.
+*/
+
+static void test_bug13524()
+{
+  MYSQL_STMT *stmt;
+  int rc;
+  unsigned int warning_count;
+  const ulong type= CURSOR_TYPE_READ_ONLY;
+  const char *query= "select * from t1";
+
+  myheader("test_bug13524");
+
+  rc= mysql_query(mysql, "drop table if exists t1, t2");
+  myquery(rc);
+  rc= mysql_query(mysql, "create table t1 (a int not null primary key)");
+  myquery(rc);
+  rc= mysql_query(mysql, "insert into t1 values (1), (2), (3), (4)");
+  myquery(rc);
+
+  stmt= mysql_stmt_init(mysql);
+  rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
+  check_execute(stmt, rc);
+
+  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);
+  check_execute(stmt, rc);
+
+  warning_count= mysql_warning_count(mysql);
+  DIE_UNLESS(warning_count == 0);
+
+  /* Check that DROP TABLE produced a warning (no such table) */
+  rc= mysql_query(mysql, "drop table if exists t2");
+  myquery(rc);
+  warning_count= mysql_warning_count(mysql);
+  DIE_UNLESS(warning_count == 1);
+
+  /*
+    Check that fetch from a cursor cleared the warning from the previous
+    command.
+  */
+  rc= mysql_stmt_fetch(stmt);
+  check_execute(stmt, rc);
+  warning_count= mysql_warning_count(mysql);
+  DIE_UNLESS(warning_count == 0);
+
+  /* Cleanup */
+  mysql_stmt_close(stmt);
+  rc= mysql_query(mysql, "drop table t1");
+  myquery(rc);
+}
+
+
+/*
   Read and parse arguments and MySQL options from my.cnf
 */
 
@@ -14744,6 +14804,7 @@
   { "test_bug12243", test_bug12243 },
   { "test_bug14210", test_bug14210 },
   { "test_bug13488", test_bug13488 },
+  { "test_bug13524", test_bug13524 },
   { 0, 0 }
 };
 
Thread
bk commit into 5.0 tree (konstantin:1.1967) BUG#13524konstantin17 Nov