List:Internals« Previous MessageNext Message »
From:ahristov Date:November 2 2005 10:14am
Subject:bk commit into 5.0 tree (andrey:1.2028)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey 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.2028 05/11/02 10:14:33 andrey@lmy004. +4 -0
  fix libmysql and mysqld to support choosing of type of read-only cursor

  sql/sql_prepare.cc
    1.160 05/11/02 10:14:22 andrey@lmy004. +12 -7
    add option to open sensitive cursor instead of materialized one.

  sql/sql_cursor.h
    1.2 05/11/02 10:14:22 andrey@lmy004. +1 -1
    add NO_CURSOR as 0 -> enum_ss_cursor_type is used in sql_prepare.cc
    as info whether cursor should be opened or not.

  libmysql/libmysql.c
    1.231 05/11/02 10:14:22 andrey@lmy004. +3 -2
    fix for sensitive (and materialized cursors)

  include/mysql_com.h
    1.103 05/11/02 10:14:21 andrey@lmy004. +3 -2
    add a type for specifically for sensitive cursors

# 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:	andrey
# Host:	lmy004.
# Root:	/work/mysql-5.0-cursor-select

--- 1.102/include/mysql_com.h	2005-10-11 23:58:17 +02:00
+++ 1.103/include/mysql_com.h	2005-11-02 10:14:21 +01:00
@@ -300,8 +300,9 @@
 {
   CURSOR_TYPE_NO_CURSOR= 0,
   CURSOR_TYPE_READ_ONLY= 1,
-  CURSOR_TYPE_FOR_UPDATE= 2,
-  CURSOR_TYPE_SCROLLABLE= 4
+  CURSOR_TYPE_READ_ONLY_SENSITIVE= 2,
+  CURSOR_TYPE_FOR_UPDATE= 4,
+  CURSOR_TYPE_SCROLLABLE= 8
 };
 
 

--- 1.230/libmysql/libmysql.c	2005-08-04 13:25:02 +02:00
+++ 1.231/libmysql/libmysql.c	2005-11-02 10:14:22 +01:00
@@ -2788,7 +2788,7 @@
   {
     ulong cursor_type;
     cursor_type= value ? *(ulong*) value : 0UL;
-    if (cursor_type > (ulong) CURSOR_TYPE_READ_ONLY)
+    if (cursor_type > (ulong) CURSOR_TYPE_READ_ONLY_SENSITIVE)
       goto err_not_implemented;
     stmt->flags= cursor_type;
     break;
@@ -2934,7 +2934,8 @@
       mysql->status= MYSQL_STATUS_READY;
       stmt->read_row_func= stmt_read_row_from_cursor;
     }
-    else if (stmt->flags & CURSOR_TYPE_READ_ONLY)
+    else if (stmt->flags & CURSOR_TYPE_READ_ONLY ||
+             stmt->flags & CURSOR_TYPE_READ_ONLY_SENSITIVE)
     {
       /*
         This is a single-row result set, a result set with no rows, EXPLAIN,

--- 1.1/sql/sql_cursor.h	2005-09-22 00:11:00 +02:00
+++ 1.2/sql/sql_cursor.h	2005-11-02 10:14:22 +01:00
@@ -60,6 +60,6 @@
 
 /* Possible values for flags */
 
-enum { ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 };
+enum enum_ss_cursor_type { NO_CURSOR= 0, ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 };
 
 #endif /* _sql_cusor_h_ */

--- 1.159/sql/sql_prepare.cc	2005-10-11 23:58:18 +02:00
+++ 1.160/sql/sql_prepare.cc	2005-11-02 10:14:22 +01:00
@@ -133,7 +133,7 @@
   inline void close_cursor() { delete cursor; cursor= 0; }
 
   bool prepare(const char *packet, uint packet_length);
-  bool execute(String *expanded_query, bool open_cursor);
+  bool execute(String *expanded_query, enum_ss_cursor_type open_cursor);
   /* Destroy this statement */
   bool deallocate();
 };
@@ -2214,7 +2214,12 @@
   if (!(specialflag & SPECIAL_NO_PRIOR))
     my_pthread_setprio(pthread_self(),QUERY_PRIOR);
   error= stmt->execute(&expanded_query,
-                       test(flags & (ulong) CURSOR_TYPE_READ_ONLY));
+                     test(flags & (ulong) CURSOR_TYPE_READ_ONLY)?
+                      ALWAYS_MATERIALIZED_CURSOR:
+                      (test(flags & (ulong) CURSOR_TYPE_READ_ONLY_SENSITIVE)?
+                       ANY_CURSOR:NO_CURSOR      
+                      )
+                     );
   if (!(specialflag & SPECIAL_NO_PRIOR))
     my_pthread_setprio(pthread_self(), WAIT_PRIOR);
   if (error == 0)
@@ -2278,7 +2283,7 @@
                                  &expanded_query))
     goto set_params_data_err;
 
-  (void) stmt->execute(&expanded_query, FALSE);
+  (void) stmt->execute(&expanded_query, NO_CURSOR);
 
   DBUG_VOID_RETURN;
 
@@ -2785,7 +2790,8 @@
     Prepared_statement::execute()
       expanded_query     A query for binlogging which has all parameter
                          markers ('?') replaced with their actual values.
-      open_cursor        True if an attempt to open a cursor should be made.
+      open_cursor        NO_CURSOR, ANY_CURSOR or ALWAYS_MATERIALIZED_CURSORS
+                         if an attempt to open a cursor should be made.
                          Currenlty used only in the binary protocol.
 
   DESCRIPTION
@@ -2803,7 +2809,7 @@
     TRUE		Error
 */
 
-bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
+bool Prepared_statement::execute(String *expanded_query, enum_ss_cursor_type open_cursor)
 {
   Statement stmt_backup;
   Query_arena *old_stmt_arena;
@@ -2881,8 +2887,7 @@
 
   thd->protocol= protocol;                      /* activate stmt protocol */
   error= (open_cursor ?
-          mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR,
-                            &result, &cursor) :
+          mysql_open_cursor(thd, (uint) open_cursor, &result, &cursor) :
           mysql_execute_command(thd));
   thd->protocol= &thd->protocol_simple;         /* use normal protocol */
 
Thread
bk commit into 5.0 tree (andrey:1.2028)ahristov2 Nov