* src/GramspDb/_GrampsBSDDB.py: Minor fixes.
svn: r6104
This commit is contained in:
parent
1bef4d52c6
commit
3af54ec416
@ -1,3 +1,6 @@
|
|||||||
|
2006-03-08 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/GramspDb/_GrampsBSDDB.py: Minor fixes.
|
||||||
|
|
||||||
2006-03-08 Don Allingham <don@gramps-project.org>
|
2006-03-08 Don Allingham <don@gramps-project.org>
|
||||||
* src/GramspDb/_GrampsBSDDB.py: make txn support optional via UseTXN
|
* src/GramspDb/_GrampsBSDDB.py: make txn support optional via UseTXN
|
||||||
|
|
||||||
|
@ -679,12 +679,12 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
if not self.readonly:
|
if not self.readonly:
|
||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
self.reference_map.delete(str(key),txn=txn)#=the_txn)
|
self.reference_map.delete(str(key),txn=txn)#=the_txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.reference_map.sync()
|
||||||
else:
|
else:
|
||||||
old_data = self.reference_map.get(str(key),txn=self.txn)
|
old_data = self.reference_map.get(str(key),txn=self.txn)
|
||||||
transaction.add(REFERENCE_KEY,str(key),old_data,None)
|
transaction.add(REFERENCE_KEY,str(key),old_data,None)
|
||||||
transaction.reference_del.append(str(key))
|
transaction.reference_del.append(str(key))
|
||||||
if not self.UseTXN:
|
|
||||||
self.reference_map.sync()
|
|
||||||
|
|
||||||
def _add_reference(self,key,data,transaction,txn=None):
|
def _add_reference(self,key,data,transaction,txn=None):
|
||||||
"""
|
"""
|
||||||
@ -698,12 +698,12 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
#the_txn = self.env.txn_begin()
|
#the_txn = self.env.txn_begin()
|
||||||
self.reference_map.put(str(key),data,txn=txn)#=the_txn)
|
self.reference_map.put(str(key),data,txn=txn)#=the_txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.reference_map.sync()
|
||||||
#the_txn.commit()
|
#the_txn.commit()
|
||||||
else:
|
else:
|
||||||
transaction.add(REFERENCE_KEY,str(key),None,data)
|
transaction.add(REFERENCE_KEY,str(key),None,data)
|
||||||
transaction.reference_add.append((str(key),data))
|
transaction.reference_add.append((str(key),data))
|
||||||
if not self.UseTXN:
|
|
||||||
self.reference_map.sync()
|
|
||||||
|
|
||||||
def reindex_reference_map(self):
|
def reindex_reference_map(self):
|
||||||
"""Reindex all primary records in the database. This will be a
|
"""Reindex all primary records in the database. This will be a
|
||||||
@ -835,24 +835,38 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
|
|
||||||
def _del_person(self,handle):
|
def _del_person(self,handle):
|
||||||
self.person_map.delete(str(handle),txn=self.txn)
|
self.person_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.person_map.sync()
|
||||||
|
|
||||||
def _del_source(self,handle):
|
def _del_source(self,handle):
|
||||||
self.source_map.delete(str(handle),txn=self.txn)
|
self.source_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.source_map.sync()
|
||||||
|
|
||||||
def _del_repository(self,handle):
|
def _del_repository(self,handle):
|
||||||
self.repository_map.delete(str(handle),txn=self.txn)
|
self.repository_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.repository_map.sync()
|
||||||
|
|
||||||
def _del_place(self,handle):
|
def _del_place(self,handle):
|
||||||
self.place_map.delete(str(handle),txn=self.txn)
|
self.place_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.place_map.sync()
|
||||||
|
|
||||||
def _del_media(self,handle):
|
def _del_media(self,handle):
|
||||||
self.media_map.delete(str(handle),txn=self.txn)
|
self.media_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.media_map.sync()
|
||||||
|
|
||||||
def _del_family(self,handle):
|
def _del_family(self,handle):
|
||||||
self.family_map.delete(str(handle),txn=self.txn)
|
self.family_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.family_map.sync()
|
||||||
|
|
||||||
def _del_event(self,handle):
|
def _del_event(self,handle):
|
||||||
self.event_map.delete(str(handle),txn=self.txn)
|
self.event_map.delete(str(handle),txn=self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
self.event_map.sync()
|
||||||
|
|
||||||
def set_name_group_mapping(self,name,group):
|
def set_name_group_mapping(self,name,group):
|
||||||
if not self.readonly:
|
if not self.readonly:
|
||||||
@ -955,8 +969,6 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
self._update_reference_map(obj,transaction)
|
self._update_reference_map(obj,transaction)
|
||||||
old_data = data_map.get(handle,txn=self.txn)
|
old_data = data_map.get(handle,txn=self.txn)
|
||||||
new_data = obj.serialize()
|
new_data = obj.serialize()
|
||||||
if not self.UseTXN:
|
|
||||||
data_map.sync()
|
|
||||||
transaction.add(key,handle,old_data,new_data)
|
transaction.add(key,handle,old_data,new_data)
|
||||||
if old_data:
|
if old_data:
|
||||||
update_list.append((handle,new_data))
|
update_list.append((handle,new_data))
|
||||||
@ -968,6 +980,8 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
retlist = []
|
retlist = []
|
||||||
for (handle,data) in add_list:
|
for (handle,data) in add_list:
|
||||||
db_map.put(handle,data,self.txn)
|
db_map.put(handle,data,self.txn)
|
||||||
|
if not self.UseTXN:
|
||||||
|
db_map.sync()
|
||||||
retlist.append(str(handle))
|
retlist.append(str(handle))
|
||||||
return retlist
|
return retlist
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user