Skip to content

Commit

Permalink
Make use of QLatin1String/QStringLiteral in HANA
Browse files Browse the repository at this point in the history
  • Loading branch information
mrylov committed Dec 8, 2020
1 parent 6dd7b06 commit 9925cab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/providers/hana/qgshanaconnection.cpp
Expand Up @@ -483,7 +483,7 @@ QVector<QgsHanaLayerProperty> QgsHanaConnection::getLayers(
layer.schemaName = rsLayers->getString( 1 );
layer.tableName = rsLayers->getString( 2 );
QString geomColumnType = rsLayers->getString( 4 );
bool isGeometryColumn = ( geomColumnType == "ST_GEOMETRY" || geomColumnType == "ST_POINT" );
bool isGeometryColumn = ( geomColumnType == QLatin1String( "ST_GEOMETRY" ) || geomColumnType == QLatin1String( "ST_POINT" ) );
layer.geometryColName = isGeometryColumn ? rsLayers->getString( 3 ) : QString();
layer.tableComment = rsLayers->getString( 5 );
layer.isView = isView;
Expand Down
14 changes: 7 additions & 7 deletions src/providers/hana/qgshanaexpressioncompiler.cpp
Expand Up @@ -108,7 +108,7 @@ QgsSqlExpressionCompiler::Result QgsHanaExpressionCompiler::compileNode(
}
else if ( funcName.toLower() == QLatin1String( "pi" ) )
{
result = "3.141592653589793238";
result = QStringLiteral( "3.141592653589793238" );
return Complete;
}
}
Expand All @@ -119,7 +119,7 @@ QgsSqlExpressionCompiler::Result QgsHanaExpressionCompiler::compileNode(
switch ( n->value().type() )
{
case QVariant::Bool:
result = n->value().toBool() ? "(1=1)" : "(1=0)";
result = n->value().toBool() ? QStringLiteral( "(1=1)" ) : QStringLiteral( "(1=0)" );
return Complete;
default:
break;
Expand All @@ -134,12 +134,12 @@ QgsSqlExpressionCompiler::Result QgsHanaExpressionCompiler::compileNode(
case QgsExpressionNodeUnaryOperator::uoNot:
{
Result resRight = compileNode( unaryOp->operand(), result );
if ( "NULL" == result.toUpper() )
if ( QLatin1String( "NULL" ) == result.toUpper() )
{
result.clear();
return Fail;
}
result = "NOT " + result;
result = QStringLiteral( "NOT " ) + result;
return resRight;
}
case QgsExpressionNodeUnaryOperator::uoMinus:
Expand All @@ -159,11 +159,11 @@ QgsSqlExpressionCompiler::Result QgsHanaExpressionCompiler::compileNode(
if ( resLeft == Fail || resRight == Fail )
return Fail;
// NULL can not appear on the left, only as part of IS NULL or IS NOT NULL
if ( "NULL" == opLeft.toUpper() )
if ( QLatin1String( "NULL" ) == opLeft.toUpper() )
return Fail;

// NULL can only be on the right for IS and IS NOT
if ( "NULL" == opRight.toUpper() &&
if ( QLatin1String( "NULL" ) == opRight.toUpper() &&
( binOp->op() != QgsExpressionNodeBinaryOperator::boIs && binOp->op() != QgsExpressionNodeBinaryOperator::boIsNot ) )
return Fail;

Expand All @@ -187,7 +187,7 @@ QgsSqlExpressionCompiler::Result QgsHanaExpressionCompiler::compileNode(
// We only support IS NULL and IS NOT NULL if the operand on the left is a column
case QgsExpressionNodeBinaryOperator::boIs:
case QgsExpressionNodeBinaryOperator::boIsNot:
if ( QStringLiteral( "NULL" ) == opRight.toUpper() )
if ( QLatin1String( "NULL" ) == opRight.toUpper() )
{
if ( binOp->opLeft()->nodeType() != QgsExpressionNode::ntColumnRef )
{
Expand Down

0 comments on commit 9925cab

Please sign in to comment.