List:Internals« Previous MessageNext Message »
From:sanja Date:December 1 2005 12:26pm
Subject:bk commit into 4.1 tree (bell:1.2478) BUG#14652
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of bell. When bell 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.2478 05/12/01 14:26:19 bell@stripped +3 -0
  We should skip beggining '(' characters when test query on possibility
  to be in the query cache. (BUG#14652)

  sql/sql_cache.cc
    1.95 05/12/01 14:26:17 bell@stripped +19 -9
    We should skip beggining '(' characters when test query on possibility
    to be in the query cache.

  mysql-test/t/query_cache.test
    1.48 05/12/01 14:26:16 bell@stripped +15 -0
    BUG#14652 test suite.

  mysql-test/r/query_cache.result
    1.60 05/12/01 14:26:16 bell@stripped +25 -0
    BUG#14652 test suite.

# 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:	bell
# Host:	sanja.is.com.ua
# Root:	/home/bell/mysql/bk/work-bug6-4.1

--- 1.94/sql/sql_cache.cc	2005-09-06 12:09:55 +03:00
+++ 1.95/sql/sql_cache.cc	2005-12-01 14:26:17 +02:00
@@ -956,16 +956,26 @@
     goto err;
   }
 
-  /*
-    Test if the query is a SELECT
-    (pre-space is removed in dispatch_command)
-  */
-  if (my_toupper(system_charset_info, sql[0]) != 'S' || 
-      my_toupper(system_charset_info, sql[1]) != 'E' ||
-      my_toupper(system_charset_info,sql[2]) !='L')
   {
-    DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
-    goto err;
+    uint i= 0;
+    /*
+      Skip '(' characters in queries like following:
+      (select a from t1) union (select a from t1);
+    */
+    while (sql[i]=='(')
+      i++;
+
+    /*
+      Test if the query is a SELECT
+      (pre-space is removed in dispatch_command)
+    */
+    if (my_toupper(system_charset_info, sql[i])     != 'S' ||
+        my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
+        my_toupper(system_charset_info, sql[i + 2]) != 'L')
+    {
+      DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
+      goto err;
+    }
   }
 
   STRUCT_LOCK(&structure_guard_mutex);

--- 1.59/mysql-test/r/query_cache.result	2005-08-04 22:45:28 +03:00
+++ 1.60/mysql-test/r/query_cache.result	2005-12-01 14:26:16 +02:00
@@ -982,4 +982,29 @@
 Variable_name	Value
 Qcache_hits	1
 drop table t1;
+create table t1 (a int);
+flush status;
+(select a from t1) union (select a from t1);
+a
+show status like "Qcache_queries_in_cache";
+Variable_name	Value
+Qcache_queries_in_cache	1
+show status like "Qcache_inserts";
+Variable_name	Value
+Qcache_inserts	1
+show status like "Qcache_hits";
+Variable_name	Value
+Qcache_hits	0
+(select a from t1) union (select a from t1);
+a
+show status like "Qcache_queries_in_cache";
+Variable_name	Value
+Qcache_queries_in_cache	1
+show status like "Qcache_inserts";
+Variable_name	Value
+Qcache_inserts	1
+show status like "Qcache_hits";
+Variable_name	Value
+Qcache_hits	1
+drop table t1;
 set GLOBAL query_cache_size=0;

--- 1.47/mysql-test/t/query_cache.test	2005-09-15 17:17:15 +03:00
+++ 1.48/mysql-test/t/query_cache.test	2005-12-01 14:26:16 +02:00
@@ -712,6 +712,21 @@
 show status like "Qcache_hits";
 drop table t1;
 
+#
+# BUG#14652: Queries with leading '(' characters.
+#
+create table t1 (a int);
+flush status;
+(select a from t1) union (select a from t1);
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+(select a from t1) union (select a from t1);
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+drop table t1;
+
 set GLOBAL query_cache_size=0;
 
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (bell:1.2478) BUG#14652sanja1 Dec