summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 0fd8d6e9b0f..f812ef862b0 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1146,7 +1146,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
See also a note on double-check locking usage above.
*/
- if (thd->locked_tables || query_cache_size == 0)
+ if (thd->locked_tables_mode || query_cache_size == 0)
DBUG_VOID_RETURN;
uint8 tables_type= 0;
@@ -1380,7 +1380,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
See also a note on double-check locking usage above.
*/
- if (is_disabled() || thd->locked_tables ||
+ if (is_disabled() || thd->locked_tables_mode ||
thd->variables.query_cache_type == 0 || query_cache_size == 0)
goto err;
@@ -1535,7 +1535,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
}
DBUG_PRINT("qcache", ("Query have result 0x%lx", (ulong) query));
- if ((thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
+ if (thd->in_multi_stmt_transaction() &&
(query->tables_type() & HA_CACHE_TBL_TRANSACT))
{
DBUG_PRINT("qcache",
@@ -1692,8 +1692,7 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used,
if (is_disabled())
DBUG_VOID_RETURN;
- using_transactions= using_transactions &&
- (thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
+ using_transactions= using_transactions && thd->in_multi_stmt_transaction();
for (; tables_used; tables_used= tables_used->next_local)
{
DBUG_ASSERT(!using_transactions || tables_used->table!=0);
@@ -1777,8 +1776,7 @@ void Query_cache::invalidate(THD *thd, TABLE *table,
if (is_disabled())
DBUG_VOID_RETURN;
- using_transactions= using_transactions &&
- (thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
+ using_transactions= using_transactions && thd->in_multi_stmt_transaction();
if (using_transactions &&
(table->file->table_cache_type() == HA_CACHE_TBL_TRANSACT))
thd->add_changed_table(table);
@@ -1796,8 +1794,7 @@ void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length,
if (is_disabled())
DBUG_VOID_RETURN;
- using_transactions= using_transactions &&
- (thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
+ using_transactions= using_transactions && thd->in_multi_stmt_transaction();
if (using_transactions) // used for innodb => has_transactions() is TRUE
thd->add_changed_table(key, key_length);
else
@@ -3569,7 +3566,7 @@ Query_cache::is_cacheable(THD *thd, size_t query_len, const char *query,
tables_type)))
DBUG_RETURN(0);
- if ((thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
+ if (thd->in_multi_stmt_transaction() &&
((*tables_type)&HA_CACHE_TBL_TRANSACT))
{
DBUG_PRINT("qcache", ("not in autocommin mode"));