53 switch ( value.
type() )
56 case QVariant::LongLong:
57 case QVariant::Double:
61 return value.
toBool() ?
"TRUE" :
"FALSE";
64 case QVariant::String:
88 result =
"( NOT " + right +
')';
103 result =
"( - (" + right +
"))";
119 bool partialCompilation =
false;
120 bool failOnPartialNode =
false;
128 partialCompilation =
true;
188 if ( nodeIsNullLiteral( n->
opLeft() ) || nodeIsNullLiteral( n->
opRight() ) )
198 if ( nodeIsNullLiteral( n->
opLeft() ) || nodeIsNullLiteral( n->
opRight() ) )
257 result =
'(' + left +
' ' + op +
' ' + right +
')';
Class for parsing and evaluation of expressions (formerly called "search strings").
virtual NodeType nodeType() const =0
Abstract virtual that returns the type of this node.
virtual ~QgsSqlExpressionCompiler()
QString & append(QChar ch)
Provider treats LIKE as case-insensitive.
QString & prepend(QChar ch)
virtual Result compile(const QgsExpression *exp)
Compiles an expression and returns the result of the compilation.
Container of fields for a vector layer.
QString join(const QString &separator) const
Provider does not support using NULL with boolean logic, eg "(...) OR NULL".
Provider does not unary minus, eg " -( 100 * 2 ) = ...".
QgsSqlExpressionCompiler(const QgsFields &fields, const Flags &flags=Flags())
Constructor for expression compiler.
const Node * rootNode() const
Returns root node of the expression. Root node is null is parsing has failed.
virtual QString quotedValue(const QVariant &value, bool &ok)
Returns a quoted attribute value, in the format expected by the provider.
virtual QString result()
Returns the compiled expression string for use by the provider.
BinaryOperator op() const
bool contains(QChar ch, Qt::CaseSensitivity cs) const
QString & replace(int position, int n, QChar after)
QString name() const
The name of the column.
int indexFromName(const QString &name) const
Look up field's index from name. Returns -1 on error.
Result
Possible results from expression compilation.
Provider performs case-insensitive string matching for all strings.
QVariant value() const
The value of the literal.
virtual QString quotedIdentifier(const QString &identifier)
Returns a quoted column identifier, in the format expected by the provider.
virtual Result compileNode(const QgsExpression::Node *node, QString &str)
Compiles an expression node and returns the result of the compilation.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const