1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

------------------------------------------------------------

revno: 2617.22.4
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: mysql-6.0-runtime
timestamp: Mon 2009-01-26 15:19:14 -0200
message:
Move checks for OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN to a separate
helper function.


sql/ha_ndbcluster.cc:
  Use helper method to check transaction mode.
sql/log.cc:
  Use helper method to check transaction mode.
sql/sql_cache.cc:
  Use helper method to check transaction mode.
sql/sql_class.cc:
  Use helper method to check transaction mode.
sql/sql_class.h:
  Add helper method to check whether session is in a multi-statement
  transaction.
sql/sql_parse.cc:
  Use helper method to check transaction mode.
sql/transaction.cc:
  Use helper method to check transaction mode.
This commit is contained in:
Konstantin Osipov
2009-12-04 01:46:14 +03:00
parent cd155be564
commit 411a81954e
7 changed files with 38 additions and 34 deletions

View File

@ -1517,7 +1517,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
}
DBUG_PRINT("qcache", ("Query have result 0x%lx", (ulong) query));
if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
if (thd->in_multi_stmt_transaction() &&
(query->tables_type() & HA_CACHE_TBL_TRANSACT))
{
DBUG_PRINT("qcache",
@ -1674,8 +1674,7 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used,
if (is_disabled())
DBUG_VOID_RETURN;
using_transactions= using_transactions &&
(thd->options & (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);
@ -1759,8 +1758,7 @@ void Query_cache::invalidate(THD *thd, TABLE *table,
if (is_disabled())
DBUG_VOID_RETURN;
using_transactions= using_transactions &&
(thd->options & (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);
@ -1778,8 +1776,7 @@ void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length,
if (is_disabled())
DBUG_VOID_RETURN;
using_transactions= using_transactions &&
(thd->options & (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
@ -3549,7 +3546,7 @@ Query_cache::is_cacheable(THD *thd, size_t query_len, const char *query,
tables_type)))
DBUG_RETURN(0);
if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
if (thd->in_multi_stmt_transaction() &&
((*tables_type)&HA_CACHE_TBL_TRANSACT))
{
DBUG_PRINT("qcache", ("not in autocommin mode"));