Skip to content

Commit 5b7e111

Browse files
committedApr 9, 2019
Actually only update the layer_styles table if it exists
1 parent 9eca405 commit 5b7e111

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎python/plugins/db_manager/db_plugins/gpkg/connector.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,10 @@ def renameTable(self, table, new_table):
634634
return False
635635

636636
# also rename any styles referring to this table
637-
self.gdal_ds.ExecuteSQL('UPDATE layer_styles SET f_table_name = %s WHERE f_table_name = %s' % (quoted_table_new, quoted_table))
638-
if gdal.GetLastErrorMsg() != '':
639-
return False
637+
if self.gdal_ds.GetLayerByName('layer_styles'):
638+
self.gdal_ds.ExecuteSQL('UPDATE layer_styles SET f_table_name = %s WHERE f_table_name = %s' % (quoted_table_new, quoted_table))
639+
if gdal.GetLastErrorMsg() != '':
640+
return False
640641

641642
# we need to reopen after renaming since OGR doesn't update its
642643
# internal state

0 commit comments

Comments
 (0)
Please sign in to comment.