Skip to content
Permalink
Browse files

Actually only update the layer_styles table if it exists

  • Loading branch information
wonder-sk committed Apr 9, 2019
1 parent 9eca405 commit 5b7e111e4ba1432638998a1c0b446e8045e880d4
Showing with 4 additions and 3 deletions.
  1. +4 −3 python/plugins/db_manager/db_plugins/gpkg/connector.py
@@ -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

0 comments on commit 5b7e111

Please sign in to comment.
You can’t perform that action at this time.