DB-API: Sped up get_tag_from_name
This commit is contained in:
parent
8317f579c2
commit
4ee8ac2585
@ -1058,11 +1058,11 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
|||||||
return (handle for handle in self.family_map.keys())
|
return (handle for handle in self.family_map.keys())
|
||||||
|
|
||||||
def get_tag_from_name(self, name):
|
def get_tag_from_name(self, name):
|
||||||
## FIXME: Slow, but typically not too many tags:
|
cur = self.dbapi.execute("""select handle from tag where order_by = ?;""",
|
||||||
for data in self.tag_map.values():
|
[self._order_by_tag_key(name)])
|
||||||
tag = Tag.create(data)
|
row = cur.fetchone()
|
||||||
if tag.name == name:
|
if row:
|
||||||
return tag
|
self.get_tag_from_handle(row[0])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_person_from_gramps_id(self, gramps_id):
|
def get_person_from_gramps_id(self, gramps_id):
|
||||||
|
Loading…
Reference in New Issue
Block a user