2006-07-18 Alex Roitman <shura@gramps-project.org>

* src/GrampsDb/_GrampsBSDDB.py
	(GrampsBSDDB._delete_primary_from_reference_map): defer deleting
	until the cursor is closed.



svn: r7040
This commit is contained in:
Alex Roitman 2006-07-19 04:29:04 +00:00
parent 7379b4b646
commit 26d491b230
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2006-07-18 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py
(GrampsBSDDB._delete_primary_from_reference_map): defer deleting
until the cursor is closed.
2006-07-18 Brian Matherly <brian@gramps-project.org>
* src/plugins/GraphViz.py: Make it work for Windows

View File

@ -619,6 +619,7 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
except:
ret = None
remove_list = set()
while (ret is not None):
(key,data) = ret
@ -631,12 +632,18 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
main_key = (handle, pickle.loads(data)[1][1])
self._remove_reference(main_key,transaction,txn)
# The trick is not to remove while inside the cursor,
# but collect them all and remove after the cursor is closed
remove_list.add(main_key)
ret = primary_cur.next_dup()
primary_cur.close()
# Now that the cursor is closed, we can remove things
for main_key in remove_list:
self._remove_reference(main_key,transaction,txn)
def _update_reference_map(self, obj, transaction, txn=None):
"""
If txn is given, then changes are written right away using txn.