Skip to content

Commit

Permalink
[oracle] Fix expression compilation of integer division
Browse files Browse the repository at this point in the history
(cherry-picked from 60a71d1)
  • Loading branch information
nyalldawson committed May 24, 2018
1 parent 375c1f1 commit 03e3815
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/providers/oracle/qgsoracleexpressioncompiler.cpp
Expand Up @@ -38,6 +38,7 @@ QgsSqlExpressionCompiler::Result QgsOracleExpressionCompiler::compileNode( const
case QgsExpression::boILike:
case QgsExpression::boNotILike:
case QgsExpression::boMod:
case QgsExpression::boIntDiv:
{
QString op1, op2;

Expand All @@ -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:
Expand All @@ -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 );
Expand Down

0 comments on commit 03e3815

Please sign in to comment.