diff options
author | unknown <monty@mysql.com> | 2004-10-27 19:52:41 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-10-27 19:52:41 +0300 |
commit | e646f8f2d19fbfd24c8cc4ce62322691e88d12d1 (patch) | |
tree | d9b411a738093cebf4896002805fdc91ca117fb1 /sql/sql_cache.cc | |
parent | 55833fb49bf8570ee11d4b85b143a9a3975733fa (diff) | |
parent | 3bdd7e77fdb66acb4d051dec2b1c4fd136a49f9c (diff) | |
download | mariadb-git-e646f8f2d19fbfd24c8cc4ce62322691e88d12d1.tar.gz |
Merge with 4.0
BitKeeper/deleted/.del-innodb-lock-master.opt~f76a4a1999728f87:
Auto merged
innobase/include/trx0sys.h:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/trx/trx0purge.c:
Auto merged
innobase/trx/trx0rseg.c:
Auto merged
mysql-test/r/innodb-lock.result:
Auto merged
mysql-test/t/innodb-lock.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/mysqld.cc:
Use local version during merge
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 0b338ebccb8..be50b48d264 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1025,9 +1025,38 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) for (; block_table != block_table_end; block_table++) { TABLE_LIST table_list; - bzero((char*) &table_list,sizeof(table_list)); + TABLE *tmptable; Query_cache_table *table = block_table->parent; + + /* + Check that we have not temporary tables with same names of tables + of this query. If we have such tables, we will not send data from + query cache, because temporary tables hide real tables by which + query in query cache was made. + */ + for (tmptable= thd->temporary_tables; tmptable ; tmptable= tmptable->next) + { + if (tmptable->key_length - TMP_TABLE_KEY_EXTRA == table->key_len() && + !memcmp(tmptable->table_cache_key, table->data(), + table->key_len())) + { + DBUG_PRINT("qcache", + ("Temporary table detected: '%s.%s'", + table_list.db, table_list.alias)); + STRUCT_UNLOCK(&structure_guard_mutex); + /* + We should not store result of this query because it contain + temporary tables => assign following variable to make check + faster. + */ + thd->safe_to_cache_query=0; + BLOCK_UNLOCK_RD(query_block); + DBUG_RETURN(-1); + } + } + + bzero((char*) &table_list,sizeof(table_list)); table_list.db = table->db(); table_list.alias= table_list.real_name= table->table(); #ifndef NO_EMBEDDED_ACCESS_CHECKS |