summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-04-06 20:20:37 +0200
committerunknown <serg@serg.mylan>2005-04-06 20:20:37 +0200
commit6f23625d4e70dd2977afcbbd7d12e5f09fe5684a (patch)
treeabb133b7b836d1b78209351049bd9031348efb6e /sql/handler.cc
parent231f705cc244365199e8a7af83e4c5756a9e132e (diff)
parentb668ee8b1bf27c1e142fbcfb20dab2b29d84595f (diff)
downloadmariadb-git-6f23625d4e70dd2977afcbbd7d12e5f09fe5684a.tar.gz
merged
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 7cd2fd303f0..785070176cb 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -505,10 +505,16 @@ void ha_close_connection(THD* thd)
"beginning of transaction" and "beginning of statement").
Only storage engines registered for the transaction/statement
will know when to commit/rollback it.
+
+ NOTE
+ trans_register_ha is idempotent - storage engine may register many
+ times per transaction.
+
*/
void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
{
THD_TRANS *trans;
+ handlerton **ht;
DBUG_ENTER("trans_register_ha");
DBUG_PRINT("enter",("%s", all ? "all" : "stmt"));
@@ -520,15 +526,12 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
else
trans= &thd->transaction.stmt;
- handlerton **ht=trans->ht;
- while (*ht)
- {
+ for (ht=trans->ht; *ht; ht++)
if (*ht == ht_arg)
DBUG_VOID_RETURN; /* already registered, return */
- ht++;
- }
trans->ht[trans->nht++]=ht_arg;
+ DBUG_ASSERT(*ht == ht_arg);
trans->no_2pc|=(ht_arg->prepare==0);
if (thd->transaction.xid.is_null())
thd->transaction.xid.set(thd->query_id);