* src/GrampsDbUtils/_Backup.py: Restore databases with transactions

enabled.

2008-03-02 Gary Burton <gary.burton@zen.co.uk>


svn: r10171
This commit is contained in:
Gary Burton 2008-03-02 22:40:15 +00:00
parent d5fd34cc4a
commit 2ccef1b175
2 changed files with 5 additions and 22 deletions

View File

@ -1,3 +1,7 @@
2008-03-02 Gary Burton <gary.burton@zen.co.uk>
* src/GrampsDbUtils/_Backup.py: Restore databases with transactions
enabled.
2008-03-02 Gary Burton <gary.burton@zen.co.uk>
* src/GrampsCfg.py:
* src/Config/_GrampsConfigKeys.py:

View File

@ -167,31 +167,10 @@ def __do_restore(database):
for (base, tbl) in __build_tbl_map(database):
backup_name = __mk_backup_name(database, base)
backup_table = open(backup_name, 'rb')
if database.UseTXN:
__load_tbl_txn(database, backup_table, tbl)
else:
__load_tbl_no_txn(backup_table, tbl)
__load_tbl_txn(database, backup_table, tbl)
database.rebuild_secondary()
def __load_tbl_no_txn(backup_table, tbl):
"""
Return the temporary backup name of the database table
@param backup_table: file containing the backup data
@type backup_table: file
@param tbl: Berkeley db database table
@type tbl: Berkeley db database table
"""
try:
while True:
data = pickle.load(backup_table)
tbl.put(data[0], data[1], txn=None)
except EOFError:
tbl.sync()
backup_table.close()
def __load_tbl_txn(database, backup_table, tbl):
"""
Return the temporary backup name of the database table