Skip to content
Permalink
Browse files

[processing] don't quote geometry column name (fix #16122)

  • Loading branch information
alexbruy committed Feb 7, 2017
1 parent bb4c8c0 commit 44698d4576d474740cbea8b1955d7ba9f9de27f9
@@ -110,7 +110,7 @@ def getConsoleCommands(self):
arguments.append('sqlite')
arguments.append('-sql')

sql = "SELECT ST_Union('{}')".format(geometry)
sql = "SELECT ST_Union({})".format(geometry)

sqlOpts = ''
if fields:
@@ -119,13 +119,13 @@ def getConsoleCommands(self):
sqlOpts += ',{}'.format(field)

if count:
sqlOpts += ", COUNT('{}') AS count".format(geometry)
sqlOpts += ", COUNT({}) AS count".format(geometry)

if stats:
sqlOpts += ", SUM('{0}') AS sum_diss, MIN('{0}') AS min_diss, MAX('{0}') AS max_diss, AVG('{0}') AS avg_diss".format(statsatt)
sqlOpts += ", SUM({0}) AS sum_diss, MIN({0}) AS min_diss, MAX({0}) AS max_diss, AVG({0}) AS avg_diss".format(statsatt)

if area:
sqlOpts += ", SUM(ST_Area('{0}')) AS area_diss, ST_Perimeter(ST_Union('{0}')) AS peri_diss".format(geometry)
sqlOpts += ", SUM(ST_Area({0})) AS area_diss, ST_Perimeter(ST_Union({0})) AS peri_diss".format(geometry)

sql = '{}{} FROM {} GROUP BY {}'.format(sql, sqlOpts, layername, field)

@@ -113,7 +113,7 @@ def processAlgorithm(self, feedback):
weight = 1.00

if weight < 0:
raise GeoAlgorithmExecutionException(self.tr('Negative weight value found. Please fix you data and try again.'))
raise GeoAlgorithmExecutionException(self.tr('Negative weight value found. Please fix your data and try again.'))

if clazz not in means:
means[clazz] = (0, 0, 0)

0 comments on commit 44698d4

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