From 19201eed6761d73ddd429c4526a4d68d8bcb36f1 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 29 Oct 2016 22:18:07 +0100 Subject: [PATCH] Improve efficiency of get_tag_from_name method --- gramps/plugins/db/dbapi/dbapi.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gramps/plugins/db/dbapi/dbapi.py b/gramps/plugins/db/dbapi/dbapi.py index 16f3da427..35c9cb64c 100644 --- a/gramps/plugins/db/dbapi/dbapi.py +++ b/gramps/plugins/db/dbapi/dbapi.py @@ -601,11 +601,10 @@ class DBAPI(DbGeneric): If no such Tag exists, None is returned. """ - self.dbapi.execute("""select handle from tag where order_by = ?;""", - [self._order_by_tag_key(name)]) + self.dbapi.execute("SELECT blob_data FROM tag WHERE name = ?", [name]) row = self.dbapi.fetchone() if row: - return self.get_tag_from_handle(row[0]) + return Tag.create(pickle.loads(row[0])) return None def get_number_of(self, obj_key):