diff options
author | monty@donna.mysql.fi <> | 2001-04-19 20:41:19 +0300 |
---|---|---|
committer | monty@donna.mysql.fi <> | 2001-04-19 20:41:19 +0300 |
commit | a94ba10f8db7556ac459e3b6d7c1ab990f47ec63 (patch) | |
tree | b9a43fcdfcccfe2291c2db879da2011530b4339f /sql/ha_berkeley.cc | |
parent | 3876d83ec1a13fc310dc1839176f9d286a384ded (diff) | |
download | mariadb-git-a94ba10f8db7556ac459e3b6d7c1ab990f47ec63.tar.gz |
Fix for BDB and LOCK TABLES
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r-- | sql/ha_berkeley.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 9dbd7b6c998..4b4894ebcd5 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -41,10 +41,9 @@ from the updated tables. Testing of: - - LOCK TABLES - Mark tables that participate in a transaction so that they are not closed during the transaction. We need to test what happens if - MySQL closes a table that is updated by a not commit transaction. + MySQL closes a table that is updated by a not commited transaction. */ @@ -1701,12 +1700,35 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) DBUG_PRINT("trans",("commiting non-updating transaction")); error=txn_commit((DB_TXN*) thd->transaction.stmt.bdb_tid,0); thd->transaction.stmt.bdb_tid=0; + transaction=0; } } } DBUG_RETURN(error); } + +/* + When using LOCK TABLE's external_lock is only called when the actual + TABLE LOCK is done. + Under LOCK TABLES, each used tables will force a call to start_stmt. +*/ + +int ha_berkeley::start_stmt(THD *thd) +{ + int error=0; + DBUG_ENTER("ha_berkeley::start_stmt"); + if (!thd->transaction.stmt.bdb_tid) + { + error=txn_begin(db_env, (DB_TXN*) thd->transaction.all.bdb_tid, + (DB_TXN**) &thd->transaction.stmt.bdb_tid, + 0); + transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid; + } + DBUG_RETURN(error); +} + + /* The idea with handler::store_lock() is the following: |