Commit 71a7b79b authored by Monty's avatar Monty

Added asssert to init_of_queries() to make it more safe

Part of review of 10.4 code by Sergei.

Other things:

- Changed return type if is_active() from my_bool to bool as this is
  only used by C++ code.
parent bb2c9581
...@@ -1386,6 +1386,7 @@ void THD::init_for_queries() ...@@ -1386,6 +1386,7 @@ void THD::init_for_queries()
We don't need to call ha_enable_transaction() as we can't have We don't need to call ha_enable_transaction() as we can't have
any active transactions that has to be committed any active transactions that has to be committed
*/ */
DBUG_ASSERT(transaction.is_empty());
transaction.on= TRUE; transaction.on= TRUE;
reset_root_defaults(mem_root, variables.query_alloc_block_size, reset_root_defaults(mem_root, variables.query_alloc_block_size,
......
...@@ -2630,10 +2630,14 @@ class THD: public THD_count, /* this must be first */ ...@@ -2630,10 +2630,14 @@ class THD: public THD_count, /* this must be first */
free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
my_bool is_active() bool is_active()
{ {
return (all.ha_list != NULL); return (all.ha_list != NULL);
} }
bool is_empty()
{
return all.is_empty() && stmt.is_empty();
}
st_transactions() st_transactions()
{ {
bzero((char*)this, sizeof(*this)); bzero((char*)this, sizeof(*this));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment