Skip to content

Commit f630c93

Browse files
committed
[mssql] Fix inefficiencies in expression compiler, resulting in
apparent hangs when compiling complex expressions Fixes #15404
1 parent f928c2e commit f630c93

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/providers/mssql/qgsmssqlexpressioncompiler.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ QgsSqlExpressionCompiler::Result QgsMssqlExpressionCompiler::compileNode( const
2828
if ( node->nodeType() == QgsExpressionNode::ntBinaryOperator )
2929
{
3030
const QgsExpressionNodeBinaryOperator *bin( static_cast<const QgsExpressionNodeBinaryOperator *>( node ) );
31+
switch ( bin->op() )
32+
{
33+
// special handling
34+
case QgsExpressionNodeBinaryOperator::boPow:
35+
case QgsExpressionNodeBinaryOperator::boRegexp:
36+
case QgsExpressionNodeBinaryOperator::boConcat:
37+
break;
38+
39+
default:
40+
// fallback to default handling
41+
return QgsSqlExpressionCompiler::compileNode( node, result );;
42+
}
43+
3144
QString op1, op2;
3245

3346
Result result1 = compileNode( bin->opLeft(), op1 );
@@ -51,7 +64,6 @@ QgsSqlExpressionCompiler::Result QgsMssqlExpressionCompiler::compileNode( const
5164
default:
5265
break;
5366
}
54-
5567
}
5668

5769
//fallback to default handling
@@ -72,7 +84,7 @@ QString QgsMssqlExpressionCompiler::quotedValue( const QVariant &value, bool &ok
7284
{
7385
case QVariant::Bool:
7486
//no boolean literal support in mssql, so fake it
75-
return value.toBool() ? "(1=1)" : "(1=0)";
87+
return value.toBool() ? QStringLiteral( "(1=1)" ) : QStringLiteral( "(1=0)" );
7688

7789
default:
7890
return QgsSqlExpressionCompiler::quotedValue( value, ok );

0 commit comments

Comments
 (0)