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> 2007-06-14 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_Backup.py (__do_restore): use transactions during restore * src/GrampsDbUtils/_Backup.py (__do_restore): use transactions during restore

View File

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

View File

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