From 679d900a66ce96b943943971f3af25c6302dc759 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 19 Jan 2006 16:30:45 +0000 Subject: [PATCH] * src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Disconnect unneeded secondary indices; (transaction_commit): Create new secondary indices to replace the ones removed. svn: r5798 --- gramps2/ChangeLog | 6 ++++- gramps2/src/GrampsDb/_GrampsBSDDB.py | 36 ++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 850822a08..6939ae980 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-01-19 Alex Roitman + * src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Disconnect + unneeded secondary indices; (transaction_commit): Create new + secondary indices to replace the ones removed. + 2006-01-17 Richard Taylor * src/ListBox.py: added import for gettext * src/ObjectSelector/_Factories.py, src/ObjectSelector/_FamilyFrame.py @@ -5,7 +10,6 @@ src/ObjectSelector/_PersonFrame.py, src/ObjectSelector/_PersonTreeFrame.py: added New button for Person view - 2006-01-18 Don Allingham * src/GrampsDb/_ReadGedcom.py: fix MARNM * src/GrampsWidgets.py: edit label for column header diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index 30a7c6e99..05c47c44f 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -374,10 +374,10 @@ class GrampsBSDDB(GrampsDbBase): callback(62) if not self.readonly: - self.person_map.associate(self.surnames, find_surname, table_flags) - self.person_map.associate(self.id_trans, find_idmap, table_flags) - self.family_map.associate(self.fid_trans, find_idmap, table_flags) - self.event_map.associate(self.eid_trans, find_idmap, table_flags) + self.person_map.associate(self.surnames, find_surname, table_flags) + self.person_map.associate(self.id_trans, find_idmap, table_flags) + self.family_map.associate(self.fid_trans,find_idmap, table_flags) + self.event_map.associate(self.eid_trans, find_idmap, table_flags) self.repository_map.associate(self.rid_trans, find_idmap, table_flags) self.repository_map.associate(self.repository_types, @@ -1077,6 +1077,16 @@ class GrampsBSDDB(GrampsDbBase): if transaction.batch: self.env.txn_checkpoint() self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn + + # Disconnect unneeded secondary indices + self.surnames.close() + junk = db.DB(self.env) + junk.remove(self.full_name,"surnames") + + self.reference_map_referenced_map.close() + junk = db.DB(self.env) + junk.remove(self.full_name,"reference_map_referenced_map") + return transaction def transaction_commit(self,transaction,msg): @@ -1097,6 +1107,24 @@ class GrampsBSDDB(GrampsDbBase): if transaction.batch: self.env.txn_checkpoint() self.env.set_flags(db.DB_TXN_NOSYNC,0) # sync txn + + table_flags = db.DB_CREATE|db.DB_AUTO_COMMIT + # create new secondary indices to replace the ones removed + self.surnames = db.DB(self.env) + self.surnames.set_flags(db.DB_DUP|db.DB_DUPSORT) + self.surnames.open(self.full_name, "surnames", db.DB_BTREE, + flags=table_flags) + self.person_map.associate(self.surnames,find_surname,table_flags) + + self.reference_map_referenced_map = db.DB(self.env) + self.reference_map_referenced_map.set_flags( + db.DB_DUP|db.DB_DUPSORT) + self.reference_map_referenced_map.open( + self.full_name, + "reference_map_referenced_map", + db.DB_BTREE, + flags=table_flags) + self.txn = None def undo(self):