List:Internals« Previous MessageNext Message »
From:Georg Richter Date:July 16 2005 12:06am
Subject:bk commit into 5.0 tree (georg:1.1928)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of georg. When georg 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.1928 05/07/16 00:06:13 georg@stripped +1 -0
  Merge grichter@stripped:/home/bk/mysql-5.0
  into lmy002.wdf.sap.corp:/home/georg/work/mysql/prod/mysql-5.0

  libmysql/libmysql.c
    1.224 05/07/16 00:06:10 georg@stripped +0 -0
    Auto merged

# 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:	georg
# Host:	lmy002.wdf.sap.corp
# Root:	/home/georg/work/mysql/prod/mysql-5.0/RESYNC

--- 1.223/libmysql/libmysql.c	2005-07-14 09:50:14 +02:00
+++ 1.224/libmysql/libmysql.c	2005-07-16 00:06:10 +02:00
@@ -1774,6 +1774,7 @@
 static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row);
 static int stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row);
 static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
+static int stmt_read_row_no_result_set(MYSQL_STMT *stmt, unsigned char **row);
 
 /*
   This function is used in mysql_stmt_store_result if
@@ -1869,6 +1870,16 @@
   }
 }
 
+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.
@@ -2026,7 +2037,7 @@
   stmt->list.data= stmt;
   stmt->state= MYSQL_STMT_INIT_DONE;
   stmt->mysql= mysql;
-  stmt->read_row_func= stmt_read_row_no_data;
+  stmt->read_row_func= stmt_read_row_no_result_set;
   stmt->prefetch_rows= DEFAULT_PREFETCH_ROWS;
   /* The rest of statement members was bzeroed inside malloc */
 
@@ -2769,6 +2780,13 @@
 stmt_read_row_no_data(MYSQL_STMT *stmt  __attribute__((unused)),
                       unsigned char **row  __attribute__((unused)))
 {
+  return MYSQL_NO_DATA;
+}
+
+static int
+stmt_read_row_no_result_set(MYSQL_STMT *stmt  __attribute__((unused)),
+                      unsigned char **row  __attribute__((unused)))
+{
   set_stmt_error(stmt, CR_NO_RESULT_SET, unknown_sqlstate);
   return 1;
 }
@@ -4590,7 +4608,8 @@
       ((rc= stmt_fetch_row(stmt, row)) && rc != MYSQL_DATA_TRUNCATED))
   {
     stmt->state= MYSQL_STMT_PREPARE_DONE;       /* XXX: this is buggy */
-    stmt->read_row_func= stmt_read_row_no_data;
+    stmt->read_row_func= (rc == MYSQL_NO_DATA) ? 
+      stmt_read_row_no_data : stmt_read_row_no_result_set;
   }
   else
   {
@@ -4907,13 +4926,12 @@
   {
     MYSQL *mysql= stmt->mysql;
     MYSQL_DATA *result= &stmt->result;
-    my_bool has_cursor= stmt->read_row_func == stmt_read_row_from_cursor;
 
     /*
       Reset stored result set if so was requested or it's a part
       of cursor fetch.
     */
-    if (result->data && (has_cursor || (flags & RESET_STORE_RESULT)))
+    if (result->data && (flags & RESET_STORE_RESULT))
     {
       /* Result buffered */
       free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
@@ -4928,7 +4946,7 @@
       for (; param < param_end; param++)
         param->long_data_used= 0;
     }
-    stmt->read_row_func= stmt_read_row_no_data;
+    stmt->read_row_func= stmt_read_row_no_result_set;
     if (mysql)
     {
       if ((int) stmt->state > (int) MYSQL_STMT_PREPARE_DONE)
@@ -4944,7 +4962,7 @@
           mysql->status= MYSQL_STATUS_READY;
         }
       }
-      if (has_cursor || (flags & RESET_SERVER_SIDE))
+      if (flags & RESET_SERVER_SIDE)
       {
         /*
           Reset the server side statement and close the server side
@@ -4960,6 +4978,7 @@
           stmt->state= MYSQL_STMT_INIT_DONE;
           return 1;
         }
+        stmt_clear_error(stmt);
       }
     }
     stmt->state= MYSQL_STMT_PREPARE_DONE;
Thread
bk commit into 5.0 tree (georg:1.1928)Georg Richter16 Jul