* 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:
parent
d5fd34cc4a
commit
2ccef1b175
@ -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:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user