svn: r5688
This commit is contained in:
Alex Roitman 2006-01-06 21:30:51 +00:00
parent 9fcf069fb9
commit b7d493d92a

View File

@ -850,6 +850,90 @@ class GrampsBSDDB(GrampsDbBase):
add_func(obj,transaction)
return obj
def find_next_person_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Person object based
off the person ID prefix.
"""
index = self.iprefix % self.pmap_index
while self.id_trans.get(str(index),txn=self.txn):
self.pmap_index += 1
index = self.iprefix % self.pmap_index
self.pmap_index += 1
return index
def find_next_place_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Place object based
off the person ID prefix.
"""
index = self.pprefix % self.lmap_index
while self.pid_trans.get(str(index),txn=self.txn):
self.lmap_index += 1
index = self.pprefix % self.lmap_index
self.lmap_index += 1
return index
def find_next_event_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Event object based
off the person ID prefix.
"""
index = self.eprefix % self.emap_index
while self.eid_trans.get(str(index),txn=self.txn):
self.emap_index += 1
index = self.eprefix % self.emap_index
self.emap_index += 1
return index
def find_next_object_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a MediaObject object based
off the person ID prefix.
"""
index = self.oprefix % self.omap_index
while self.oid_trans.get(str(index),txn=self.txn):
self.omap_index += 1
index = self.oprefix % self.omap_index
self.omap_index += 1
return index
def find_next_source_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Source object based
off the person ID prefix.
"""
index = self.sprefix % self.smap_index
while self.sid_trans.get(str(index),txn=self.txn):
self.smap_index += 1
index = self.sprefix % self.smap_index
self.smap_index += 1
return index
def find_next_family_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Family object based
off the person ID prefix.
"""
index = self.fprefix % self.fmap_index
while self.fid_trans.get(str(index),txn=self.txn):
self.fmap_index += 1
index = self.fprefix % self.fmap_index
self.fmap_index += 1
return index
def find_next_repository_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Respository object based
off the repository ID prefix.
"""
index = self.rprefix % self.rmap_index
while self.rid_trans.get(str(index),txn=self.txn):
self.rmap_index += 1
index = self.rprefix % self.rmap_index
self.rmap_index += 1
return index
def transaction_begin(self,msg=""):
"""
Creates a new Transaction tied to the current UNDO database. The