Skip to content
Permalink
Browse files

[processing] support more field types

  • Loading branch information
alexbruy committed Jun 27, 2016
1 parent 7b1ee07 commit 1b60b088a22ce2b417ec8a2c69266b98efa663f2
@@ -79,8 +79,8 @@ def processAlgorithm(self, progress):
if useField:
index = layer.fieldNameIndex(fieldName)
fType = layer.pendingFields()[index].type()
if fType == QVariant.Int:
f.setType(QVariant.Int)
if fType in [QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
f.setType(fType)
f.setLength(20)
elif fType == QVariant.Double:
f.setType(QVariant.Double)
@@ -95,7 +95,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException(
self.tr('Operators %s can be used only with string fields.' % op))

if fieldType in [QVariant.Int, QVariant.Double]:
if fieldType in [QVariant.Int, QVariant.Double, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
expr = '"%s" %s %s' % (fieldName, operator, value)
elif fieldType == QVariant.String:
if operator not in self.OPERATORS[-2:]:
@@ -97,7 +97,7 @@ def processAlgorithm(self, progress):
sattributes = feature.attributes()
dattributes = []
for dindex, dfield in enumerate(fields):
if (dfield.type() == QVariant.Int):
if (dfield.type() == QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong):
dattribute = 0
elif (dfield.type() == QVariant.Double):
dattribute = 0.0
@@ -94,7 +94,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException(
self.tr('Operators %s can be used only with string fields.' % op))

if fieldType in [QVariant.Int, QVariant.Double]:
if fieldType in [QVariant.Int, QVariant.Double, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
expr = '"%s" %s %s' % (fieldName, operator, value)
elif fieldType == QVariant.String:
if operator not in self.OPERATORS[-2:]:

0 comments on commit 1b60b08

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