Skip to content
Permalink
Browse files

[oracle] Fix expression compilation of integer division

(cherry-picked from 60a71d1)
  • Loading branch information
nyalldawson committed Apr 16, 2018
1 parent 375c1f1 commit 03e381524e98ec43cd683ea0e5c15dfe2b4f15ea
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/providers/oracle/qgsoracleexpressioncompiler.cpp
@@ -38,6 +38,7 @@ QgsSqlExpressionCompiler::Result QgsOracleExpressionCompiler::compileNode( const
case QgsExpression::boILike:
case QgsExpression::boNotILike:
case QgsExpression::boMod:
case QgsExpression::boIntDiv:
{
QString op1, op2;

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

case QgsExpression::boIntDiv:
result = QString( "FLOOR(%1 / %2)" ).arg( op1, op2 );
return Complete;

case QgsExpression::boMod :
result = QString( "MOD(%1,%2)" ).arg( op1, op2 );
return Complete;

default:
break;
}
break; // no warnings
}

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

default:
return QgsOracleConn::quotedValue( value );

0 comments on commit 03e3815

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