* src/GrampsDb/_DbUtils.py (db_copy): Use batch transaction.

* src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Proper indentation.


svn: r6606
This commit is contained in:
Alex Roitman 2006-05-10 14:23:38 +00:00
parent 2ee29d05f2
commit 99db21d8fe
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-05-10 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_DbUtils.py (db_copy): Use batch transaction.
* src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Proper indentation.
2006-05-09 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: search bar implementation
* src/PeopleModel.py: search bar implementation

View File

@ -193,6 +193,9 @@ def db_copy(from_db,to_db,callback):
oldval = 0
count = 0
# Start batch transaction to use async TXN and other tricks
trans = to_db.transaction_begin("",batch=True)
for table_name in primary_tables.keys():
cursor_func = primary_tables[table_name]['cursor_func']
table = primary_tables[table_name]['table']
@ -207,6 +210,9 @@ def db_copy(from_db,to_db,callback):
update(callback,count,oldval,total)
cursor.close()
# Commit batch transaction: does nothing, except undoing the tricks
to_db.transaction_commit(trans,"")
# The metadata is always transactionless,
# and the table is small, so using key iteration is OK here.
for handle in from_db.metadata.keys():

View File

@ -1076,7 +1076,7 @@ class GrampsBSDDB(GrampsDbBase):
if transaction.batch:
if self.UseTXN:
self.env.txn_checkpoint()
self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn
self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn
if self.secondary_connected and not transaction.no_magic:
# Disconnect unneeded secondary indices