* src/GrampsBSDDB.py: use cursors to rebuild secondary indices.
svn: r5339
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2005-10-19 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsBSDDB.py: use cursors to rebuild secondary indices.
|
||||
* src/Sources.py: fix typo on gladeif call
|
||||
|
||||
2005-10-19 Stefan Bjork <skalman@acc.umu.se>
|
||||
|
@@ -225,10 +225,14 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.person_map.associate(self.surnames, find_surname, db.DB_CREATE)
|
||||
self.person_map.associate(self.id_trans, find_idmap, db.DB_CREATE)
|
||||
|
||||
for key in self.person_map.keys():
|
||||
cursor = self.get_person_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
if callback:
|
||||
callback()
|
||||
self.person_map[key] = self.person_map[key]
|
||||
self.person_map[data[0]] = data[1]
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
self.person_map.sync()
|
||||
|
||||
@@ -242,10 +246,15 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.fid_trans.truncate()
|
||||
self.family_map.associate(self.fid_trans, find_idmap, db.DB_CREATE)
|
||||
|
||||
for key in self.family_map.keys():
|
||||
|
||||
cursor = self.get_family_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
if callback:
|
||||
callback()
|
||||
self.family_map[key] = self.family_map[key]
|
||||
self.family_map[data[0]] = data[1]
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
self.family_map.sync()
|
||||
|
||||
# Repair secondary indices related to place_map
|
||||
@@ -258,10 +267,14 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.pid_trans.truncate()
|
||||
self.place_map.associate(self.pid_trans, find_idmap, db.DB_CREATE)
|
||||
|
||||
for key in self.place_map.keys():
|
||||
cursor = self.get_place_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
if callback:
|
||||
callback()
|
||||
self.place_map[key] = self.place_map[key]
|
||||
self.place_map[data[0]] = data[1]
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
self.place_map.sync()
|
||||
|
||||
# Repair secondary indices related to media_map
|
||||
@@ -274,10 +287,14 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.oid_trans.truncate()
|
||||
self.media_map.associate(self.oid_trans, find_idmap, db.DB_CREATE)
|
||||
|
||||
for key in self.media_map.keys():
|
||||
cursor = self.get_media_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
if callback:
|
||||
callback()
|
||||
self.media_map[key] = self.media_map[key]
|
||||
self.media_map[data[0]] = data[1]
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
self.media_map.sync()
|
||||
|
||||
# Repair secondary indices related to source_map
|
||||
@@ -290,10 +307,14 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.sid_trans.truncate()
|
||||
self.source_map.associate(self.sid_trans, find_idmap, db.DB_CREATE)
|
||||
|
||||
for key in self.source_map.keys():
|
||||
cursor = self.get_source_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
if callback:
|
||||
callback()
|
||||
self.source_map[key] = self.source_map[key]
|
||||
self.source_map[data[0]] = data[1]
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
self.source_map.sync()
|
||||
|
||||
def abort_changes(self):
|
||||
@@ -867,3 +888,21 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.family_event_names.add(event.name)
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
import sys
|
||||
|
||||
d = GrampsBSDDB()
|
||||
d.load(sys.argv[1],lambda x: x)
|
||||
|
||||
c = d.get_person_cursor()
|
||||
data = c.first()
|
||||
while data:
|
||||
person = Person(data[1])
|
||||
print data[0], person.get_primary_name().get_name(),
|
||||
data = c.next()
|
||||
c.close()
|
||||
|
||||
print d.surnames.keys()
|
||||
|
||||
|
Reference in New Issue
Block a user