diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 344dc02dc..c11b75a4b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-08-01 Alex Roitman + * src/GrampsDb/_GrampsBSDDB.py (set_name_group_mapping): Use + transaction. + 2006-07-31 Alex Roitman * src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as a constructor argument; (SearchBar.apply_filter): pass dbstate. diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index a6a6e592b..fb67fd6ed 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -978,12 +978,21 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): def set_name_group_mapping(self,name,group): if not self.readonly: - name = str(name) - data = self.name_group.get(name,txn=self.txn) - if not group and data: - self.name_group.delete(name,txn=self.txn) + if self.UseTXN: + # Start transaction if needed + the_txn = self.env.txn_begin() else: - self.name_group.put(name,group,txn=self.txn) + the_txn = None + name = str(name) + data = self.name_group.get(name,txn=the_txn) + if not group and data: + self.name_group.delete(name,txn=the_txn) + else: + self.name_group.put(name,group,txn=the_txn) + if self.UseTXN: + the_txn.commit() + else: + self.name_group.sync() self.emit('person-rebuild') def get_surname_list(self):