Fix dbapi set_name_group_mapping to properly close transaction

Fixes #10730
This commit is contained in:
prculley 2018-11-15 10:08:31 -06:00 committed by Nick Hall
parent 88373c0eb6
commit b4b7911405

View File

@ -572,6 +572,7 @@ class DBAPI(DbGeneric):
""" """
Set the default grouping name for a surname. Set the default grouping name for a surname.
""" """
self._txn_begin()
self.dbapi.execute("SELECT 1 FROM name_group WHERE name = ?", self.dbapi.execute("SELECT 1 FROM name_group WHERE name = ?",
[name]) [name])
row = self.dbapi.fetchone() row = self.dbapi.fetchone()
@ -582,6 +583,7 @@ class DBAPI(DbGeneric):
self.dbapi.execute( self.dbapi.execute(
"INSERT INTO name_group (name, grouping) VALUES (?, ?)", "INSERT INTO name_group (name, grouping) VALUES (?, ?)",
[name, grouping]) [name, grouping])
self._txn_commit()
def _commit_base(self, obj, obj_key, trans, change_time): def _commit_base(self, obj, obj_key, trans, change_time):
""" """