23 QgsSQLiteExpressionCompiler::QgsSQLiteExpressionCompiler(
const QgsFields &fields )
34 switch ( static_cast<const QgsExpressionNodeBinaryOperator *>( node )->op() )
53 QString QgsSQLiteExpressionCompiler::quotedIdentifier(
const QString &identifier )
58 QString QgsSQLiteExpressionCompiler::quotedValue(
const QVariant &value,
bool &ok )
64 QString QgsSQLiteExpressionCompiler::sqlFunctionFromFunctionName(
const QString &fnName )
const 66 static const QMap<QString, QString> FN_NAMES
70 {
"coalesce",
"coalesce" },
77 return FN_NAMES.value( fnName, QString() );
80 QString QgsSQLiteExpressionCompiler::castToReal(
const QString &value )
const 82 return QStringLiteral(
"CAST((%1) AS REAL)" ).arg( value );
85 QString QgsSQLiteExpressionCompiler::castToInt(
const QString &value )
const 87 return QStringLiteral(
"CAST((%1) AS INTEGER)" ).arg( value );
90 QString QgsSQLiteExpressionCompiler::castToText(
const QString &value )
const 92 return QStringLiteral(
"CAST((%1) AS TEXT)" ).arg( value );
static QString quotedValue(const QVariant &value)
Returns a properly quoted and escaped version of value for use in SQL strings.
static QString quotedIdentifier(const QString &identifier)
Returns a properly quoted version of identifier.
Container of fields for a vector layer.
Provider cannot handle expression.
Abstract base class for all nodes that can appear in an expression.
Generic expression compiler for translation to provider specific SQL WHERE clauses.
Result
Possible results from expression compilation.
virtual Result compileNode(const QgsExpressionNode *node, QString &str)
Compiles an expression node and returns the result of the compilation.
virtual QString result()
Returns the compiled expression string for use by the provider.
virtual QgsExpressionNode::NodeType nodeType() const =0
Gets the type of this node.