List:Internals« Previous MessageNext Message »
From:sinisa Date:December 7 2004 5:12pm
Subject:bk commit into 4.1 tree (Sinisa:1.2126)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of Sinisa. When Sinisa 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.2126 04/12/07 19:12:29 Sinisa@stripped +3 -0
  Fix for a bug #6996

  tests/client_test.c
    1.138 04/12/07 19:12:21 Sinisa@stripped +62 -0
    Addition of a test for fix of the bug #6996 in client_test.c

  libmysql/libmysql.c
    1.280 04/12/07 19:12:21 Sinisa@stripped +6 -0
    Fix for a bug #6996
    
    This fix enables that after all rows are read from a buffered result,
    mysql_stmt_data_seek(stmt,0) can rewind a counter to the beginning,
    so that rows can be re-fetched.

  BitKeeper/etc/ignore
    1.213 04/12/07 19:12:21 Sinisa@stripped +2 -0
    Added analyse.test client/mysqladmin.c to the ignore list

# 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:	Sinisa
# Host:	sinisa.nasamreza.org
# Root:	/mnt/work/mysql-4.1

--- 1.279/libmysql/libmysql.c	Fri Nov 19 16:56:05 2004
+++ 1.280/libmysql/libmysql.c	Tue Dec  7 19:12:21 2004
@@ -4413,6 +4413,12 @@
   for (; tmp && row; --row, tmp= tmp->next)
     ;
   stmt->data_cursor= tmp;
+  if (!row && tmp)
+  {
+       /*  Rewind the counter */
+    stmt->read_row_func= stmt_read_row_buffered;
+    stmt->state= MYSQL_STMT_EXECUTE_DONE;
+  }
   DBUG_VOID_RETURN;
 }
 

--- 1.212/BitKeeper/etc/ignore	Thu Dec  2 14:08:10 2004
+++ 1.213/BitKeeper/etc/ignore	Tue Dec  7 19:12:21 2004
@@ -943,3 +943,5 @@
 libmysqld/ha_archive.cc
 libmysqld/ha_example.cc
 libmysqld/ha_tina.cc
+analyse.test
+client/mysqladmin.c

--- 1.137/tests/client_test.c	Thu Dec  2 14:08:07 2004
+++ 1.138/tests/client_test.c	Tue Dec  7 19:12:21 2004
@@ -11389,6 +11389,67 @@
   myquery(rc);
 }
 
+static void test_rewind(void)
+{
+  MYSQL_STMT *stmt;
+  MYSQL_BIND bind;
+  int rc = 0;
+  const char *stmt_text;
+  long unsigned int length=4, Data=0;
+  my_bool isnull=0;
+
+  myheader("test_rewind");
+
+  stmt_text= "CREATE TABLE t1 (a int)";
+  rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+  myquery(rc);
+  stmt_text= "INSERT INTO t1 VALUES(2),(3),(4)";
+  rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+  myquery(rc);
+
+  stmt= mysql_stmt_init(mysql);
+
+  stmt_text= "SELECT * FROM t1";
+  rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+  check_execute(stmt, rc);
+
+  bzero(&bind,sizeof(MYSQL_BIND));
+  bind.buffer_type= MYSQL_TYPE_LONG;
+  bind.buffer= (void *)&Data; /* this buffer won't be altered */
+  bind.length= &length;
+  bind.is_null= &isnull;
+
+  rc= mysql_stmt_execute(stmt);
+  check_execute(stmt, rc);
+
+  rc= mysql_stmt_store_result(stmt);
+  DIE_UNLESS(rc == 0);
+
+  rc= mysql_stmt_bind_result(stmt, &bind);
+  DIE_UNLESS(rc == 0);
+
+  /* retreive all result sets till we are at the end */
+  while(!mysql_stmt_fetch(stmt))
+      printf("fetched result:%ld\n", Data);
+
+  DIE_UNLESS(rc != MYSQL_NO_DATA);
+
+  /* seek to the first row */
+  mysql_stmt_data_seek(stmt, 0);
+
+  /* now we should be able to fetch the results again */
+  /* but mysql_stmt_fetch returns MYSQL_NO_DATA */
+  while(!(rc= mysql_stmt_fetch(stmt)))
+      printf("fetched result after seek:%ld\n", Data);
+  
+  DIE_UNLESS(rc == MYSQL_NO_DATA);
+
+  stmt_text= "DROP TABLE t1";
+  rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+  myquery(rc);
+  rc= mysql_stmt_free_result(stmt);
+  rc= mysql_stmt_close(stmt);
+}
 
 /*
   Read and parse arguments and MySQL options from my.cnf
@@ -11594,6 +11655,7 @@
   { "test_datetime_ranges", test_datetime_ranges },
   { "test_bug4172", test_bug4172 },
   { "test_conversion", test_conversion },
+  { "test_rewind", test_rewind },
   { 0, 0 }
 };
 
Thread
bk commit into 4.1 tree (Sinisa:1.2126)sinisa7 Dec