Loading mysql-test/r/query_cache.result +25 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,31 @@ group_concat(a) 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 Loading mysql-test/t/query_cache.test +15 −0 Original line number Diff line number Diff line Loading @@ -742,6 +742,21 @@ show status like "Qcache_inserts"; 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; # # SP cursors and selects with query cache (BUG#9715) # Loading sql/sql_cache.cc +24 −14 Original line number Diff line number Diff line Loading @@ -977,22 +977,32 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) 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). (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] != '/') 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); if (query_cache_size == 0) Loading Loading
mysql-test/r/query_cache.result +25 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,31 @@ group_concat(a) 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 Loading
mysql-test/t/query_cache.test +15 −0 Original line number Diff line number Diff line Loading @@ -742,6 +742,21 @@ show status like "Qcache_inserts"; 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; # # SP cursors and selects with query cache (BUG#9715) # Loading
sql/sql_cache.cc +24 −14 Original line number Diff line number Diff line Loading @@ -977,22 +977,32 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) 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). (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] != '/') 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); if (query_cache_size == 0) Loading