2007-06-14 Alex Roitman <shura@gramps-project.org>

* src/GrampsDbUtils/_Backup.py (__do_restore): Minor optimization.
	* src/GrampsDb/_GrampsDbBase.py (__get_from_handle): Pass txn.



svn: r8555
This commit is contained in:
Alex Roitman 2007-06-15 05:47:07 +00:00
parent 2caf3dd35a
commit b5f51cf15f
3 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2007-06-14 Alex Roitman <shura@gramps-project.org>
* src/GrampsDbUtils/_Backup.py (__do_restore): Minor optimization.
* src/GrampsDb/_GrampsDbBase.py (__get_from_handle): Pass txn.
2007-06-14 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_Backup.py (__do_restore): use transactions during restore

View File

@ -748,9 +748,7 @@ class GrampsDbBase(GrampsDBCallback):
return index
def __get_from_handle(self, handle, class_type, data_map):
if not data_map:
return
data = data_map.get(str(handle))
data = data_map.get(str(handle),txn=self.txn)
if data:
newobj = class_type()
newobj.unserialize(data)

View File

@ -127,11 +127,10 @@ def __do_restore(database):
data = pickle.load(backup_table)
if database.UseTXN:
txn = database.env.txn_begin()
else:
txn = None
tbl.put(data[0], data[1], txn=txn)
if txn:
tbl.put(data[0], data[1], txn=txn)
txn.commit()
else:
tbl.put(data[0], data[1], txn=None)
except EOFError:
if not database.UseTXN:
tbl.sync()