Skip to content

Commit 03e3815

Browse files
committedMay 24, 2018
[oracle] Fix expression compilation of integer division
(cherry-picked from 60a71d1)
1 parent 375c1f1 commit 03e3815

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/providers/oracle/qgsoracleexpressioncompiler.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ QgsSqlExpressionCompiler::Result QgsOracleExpressionCompiler::compileNode( const
3838
case QgsExpression::boILike:
3939
case QgsExpression::boNotILike:
4040
case QgsExpression::boMod:
41+
case QgsExpression::boIntDiv:
4142
{
4243
QString op1, op2;
4344

@@ -63,13 +64,18 @@ QgsSqlExpressionCompiler::Result QgsOracleExpressionCompiler::compileNode( const
6364
result = QString( "NOT lower(%1) LIKE lower(%2)" ).arg( op1, op2 );
6465
return Complete;
6566

67+
case QgsExpression::boIntDiv:
68+
result = QString( "FLOOR(%1 / %2)" ).arg( op1, op2 );
69+
return Complete;
70+
6671
case QgsExpression::boMod :
6772
result = QString( "MOD(%1,%2)" ).arg( op1, op2 );
6873
return Complete;
6974

7075
default:
7176
break;
7277
}
78+
break; // no warnings
7379
}
7480

7581
default:
@@ -94,7 +100,7 @@ QString QgsOracleExpressionCompiler::quotedValue( const QVariant& value, bool& o
94100
{
95101
case QVariant::Bool:
96102
//no boolean literal support in Oracle, so fake it
97-
return value.toBool() ? "(1=1)" : "(1=0)";
103+
return value.toBool() ? QString( "(1=1)" ) : QString( "(1=0)" );
98104

99105
default:
100106
return QgsOracleConn::quotedValue( value );

0 commit comments

Comments
 (0)
Please sign in to comment.