Skip to content
Permalink
Browse files

[processing] support more field types

(cherry picked from commit 1b60b08)
  • Loading branch information
alexbruy committed Jun 27, 2016
1 parent e29eb57 commit 9b1380c0e426aab2abe54ba65fc1fbe3c3e5b086
@@ -70,8 +70,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:]:
@@ -92,7 +92,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 9b1380c

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