summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-07-23 07:51:25 +0300
committerunknown <bell@sanja.is.com.ua>2005-07-23 07:51:25 +0300
commitcebe1b5db71132a7bf0b3ffcb2d3bf3347be6384 (patch)
treea2a0c56d21bac807f50433c48eb6e27bf4d30b2e /sql
parent5ae1fd9d0dd446b698222f5442c227210f012548 (diff)
downloadmariadb-git-cebe1b5db71132a7bf0b3ffcb2d3bf3347be6384.tar.gz
store SERVER_MORE_RESULTS_EXISTS in key of query cache (BUG#6897)
mysql-test/r/query_cache.result: query in QC from normal execution and SP mysql-test/t/query_cache.test: environment restoring fix layout fix query in QC from normal execution and SP sql/mysql_priv.h: store SERVER_MORE_RESULTS_EXISTS sql/sql_cache.cc: store SERVER_MORE_RESULTS_EXISTS in key of query cache BitKeeper/etc/config: switching logging off
Diffstat (limited to 'sql')
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/sql_cache.cc46
2 files changed, 39 insertions, 8 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 2add9ac9269..0e2912e0a6d 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -521,6 +521,7 @@ struct Query_cache_query_flags
{
unsigned int client_long_flag:1;
unsigned int client_protocol_41:1;
+ unsigned int more_results_exists:1;
uint character_set_client_num;
uint character_set_results_num;
uint collation_connection_num;
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 430e0fbcabf..d2721e93f12 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -775,10 +775,11 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
Query_cache_query_flags flags;
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
- flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ?
- 1 : 0);
- flags.client_protocol_41= (thd->client_capabilities & CLIENT_PROTOCOL_41 ?
- 1 : 0);
+ flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG);
+ flags.client_protocol_41= test(thd->client_capabilities &
+ CLIENT_PROTOCOL_41);
+ flags.more_results_exists= test(thd->server_status &
+ SERVER_MORE_RESULTS_EXISTS);
flags.character_set_client_num=
thd->variables.character_set_client->number;
flags.character_set_results_num=
@@ -792,6 +793,20 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.sql_mode= thd->variables.sql_mode;
flags.max_sort_length= thd->variables.max_sort_length;
flags.group_concat_max_len= thd->variables.group_concat_max_len;
+ DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, \
+CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
+sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
+ (int)flags.client_long_flag,
+ (int)flags.client_protocol_41,
+ (int)flags.more_results_exists,
+ flags.character_set_client_num,
+ flags.character_set_results_num,
+ flags.collation_connection_num,
+ flags.limit,
+ (ulong)flags.time_zone,
+ flags.sql_mode,
+ flags.max_sort_length,
+ flags.group_concat_max_len));
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size == 0)
@@ -974,10 +989,11 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
- flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ?
- 1 : 0);
- flags.client_protocol_41= (thd->client_capabilities & CLIENT_PROTOCOL_41 ?
- 1 : 0);
+ flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG);
+ flags.client_protocol_41= test(thd->client_capabilities &
+ CLIENT_PROTOCOL_41);
+ flags.more_results_exists= test(thd->server_status &
+ SERVER_MORE_RESULTS_EXISTS);
flags.character_set_client_num= thd->variables.character_set_client->number;
flags.character_set_results_num=
(thd->variables.character_set_results ?
@@ -989,6 +1005,20 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
flags.sql_mode= thd->variables.sql_mode;
flags.max_sort_length= thd->variables.max_sort_length;
flags.group_concat_max_len= thd->variables.group_concat_max_len;
+ DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, \
+CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
+sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
+ (int)flags.client_long_flag,
+ (int)flags.client_protocol_41,
+ (int)flags.more_results_exists,
+ flags.character_set_client_num,
+ flags.character_set_results_num,
+ flags.collation_connection_num,
+ flags.limit,
+ (ulong)flags.time_zone,
+ flags.sql_mode,
+ flags.max_sort_length,
+ flags.group_concat_max_len));
memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
&flags, QUERY_CACHE_FLAGS_SIZE);
query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql,