Skip to content

Commit

Permalink
Actually only update the layer_styles table if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Apr 9, 2019
1 parent 9eca405 commit 5b7e111
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/plugins/db_manager/db_plugins/gpkg/connector.py
Expand Up @@ -634,9 +634,10 @@ def renameTable(self, table, new_table):
return False

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

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

0 comments on commit 5b7e111

Please sign in to comment.