Commit c64dda59 authored by unknown's avatar unknown

allow to look up queries with leading comments


BitKeeper/etc/ignore:
  Added libmysqld/sp_cache.cc to the ignore list
mysql-test/r/query_cache.result:
  test of query with leding comment
mysql-test/t/query_cache.test:
  test of query with leding comment
parent c8d7ca2b
......@@ -625,3 +625,4 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
libmysqld/sp_cache.cc
......@@ -699,3 +699,27 @@ Variable_name Value
Qcache_queries_in_cache 2
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
create table t1 (a int);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 41
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 13
/**/ select * from t1;
a
/**/ select * 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 42
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 14
drop table t1;
......@@ -477,3 +477,17 @@ select * from t1;
show status like "Qcache_queries_in_cache";
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
#
# comments before command
#
create table t1 (a int);
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
/**/ select * from t1;
/**/ select * from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop table t1;
......@@ -905,11 +905,16 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
/*
Test if the query is a SELECT
(pre-space is removed in dispatch_command)
(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' ||
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')
my_toupper(system_charset_info,sql[2]) !='L') &&
sql[0] != '/')
{
DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment