List:Internals« Previous MessageNext Message »
From:sanja Date:December 1 2005 12:38pm
Subject:bk commit into 5.0 tree (bell:1.2037)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.2037 05/12/01 14:38:29 bell@stripped +4 -0
  Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
  into  sanja.is.com.ua:/home/bell/mysql/bk/work-merge1-5.0

  sql/sql_cache.cc
    1.88 05/12/01 14:38:25 bell@stripped +8 -7
    merge

  mysql-test/t/query_cache.test
    1.50 05/12/01 14:38:25 bell@stripped +1 -1
    merge

  mysql-test/r/query_cache.result
    1.66 05/12/01 14:38:25 bell@stripped +0 -0
    merge

  configure.in
    1.367 05/12/01 14:38:25 bell@stripped +0 -2
    merge

# 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-merge1-5.0/RESYNC

--- 1.87/sql/sql_cache.cc	2005-12-01 12:01:32 +02:00
+++ 1.88/sql/sql_cache.cc	2005-12-01 14:38:25 +02:00
@@ -977,21 +977,31 @@
     goto err;
   }
 
-  /*
-    Test if the query is a SELECT
-    (pre-space is removed in dispatch_command).
-
-    First '/' looks like comment before command it is not
-    frequently appeared in real lihe, consequently we can
-    check all such queries, too.
-  */
-  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') &&
-      sql[0] != '/')
   {
-    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)
+
+      First '/' looks like comment before command it is not
+      frequently appeared in real lihe, consequently we can
+      check all such queries, too.
+    */
+    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') &&
+        sql[i] != '/')
+    {
+      DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
+      goto err;
+    }
   }
 
   STRUCT_LOCK(&structure_guard_mutex);

--- 1.65/mysql-test/r/query_cache.result	2005-10-24 09:36:17 +03:00
+++ 1.66/mysql-test/r/query_cache.result	2005-12-01 14:38:25 +02:00
@@ -850,6 +850,31 @@
 set group_concat_max_len=default;
 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;
+create table t1 (a int);
 show status like "Qcache_queries_in_cache";
 Variable_name	Value
 Qcache_queries_in_cache	0

--- 1.49/mysql-test/t/query_cache.test	2005-10-24 09:36:17 +03:00
+++ 1.50/mysql-test/t/query_cache.test	2005-12-01 14:38:25 +02:00
@@ -743,6 +743,21 @@
 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;
+
+#
 # SP cursors and selects with query cache (BUG#9715)
 #
 create table t1 (a int);
Thread
bk commit into 5.0 tree (bell:1.2037)sanja1 Dec