From ac86c415a7154895f48980377ee0907b8b10ab50 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Tue, 12 Dec 2017 22:25:23 +0000 Subject: [PATCH] Use UPDATE instead of DELETE and INSERT --- gramps/plugins/db/dbapi/dbapi.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gramps/plugins/db/dbapi/dbapi.py b/gramps/plugins/db/dbapi/dbapi.py index eb95ff604..425f5c7aa 100644 --- a/gramps/plugins/db/dbapi/dbapi.py +++ b/gramps/plugins/db/dbapi/dbapi.py @@ -567,11 +567,12 @@ class DBAPI(DbGeneric): [name]) row = self.dbapi.fetchone() if row: - self.dbapi.execute("DELETE FROM name_group WHERE name = ?", - [name]) - self.dbapi.execute( - "INSERT INTO name_group (name, grouping) VALUES(?, ?)", - [name, grouping]) + self.dbapi.execute("UPDATE name_group SET grouping=? " + "WHERE name = ?", [grouping, name]) + else: + self.dbapi.execute( + "INSERT INTO name_group (name, grouping) VALUES (?, ?)", + [name, grouping]) def _commit_base(self, obj, obj_key, trans, change_time): """