QGIS API Documentation
3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
src
core
qgssqlexpressioncompiler.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgssqlexpressioncompiler.h
3
--------------------------
4
begin : November 2015
5
copyright : (C) 2015 Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSSQLEXPRESSIONCOMPILER_H
17
#define QGSSQLEXPRESSIONCOMPILER_H
18
19
#define SIP_NO_FILE
20
21
#include "qgis_core.h"
22
#include "
qgsfields.h
"
23
#include "
qgsexpressionnodeimpl.h
"
24
25
class
QgsExpression
;
26
class
QgsExpressionNode
;
27
39
class
CORE_EXPORT
QgsSqlExpressionCompiler
40
{
41
public
:
42
44
enum
Result
45
{
46
None
,
47
Complete
,
48
Partial
,
49
Fail
50
};
51
55
enum
Flag
56
{
57
CaseInsensitiveStringMatch = 1,
58
LikeIsCaseInsensitive = 1 << 1,
59
NoNullInBooleanLogic = 1 << 2,
60
NoUnaryMinus = 1 << 3,
61
IntegerDivisionResultsInInteger = 1 << 4,
62
};
63
Q_DECLARE_FLAGS(
Flags
,
Flag
)
64
65
73
explicit
QgsSqlExpressionCompiler
(
const
QgsFields
&fields,
QgsSqlExpressionCompiler::Flags
flags =
Flags
(),
bool
ignoreStaticNodes =
false
);
74
virtual
~QgsSqlExpressionCompiler
() =
default
;
75
79
virtual
Result
compile(
const
QgsExpression
*exp );
80
84
virtual
QString result();
85
100
bool
opIsStringComparison(
QgsExpressionNodeBinaryOperator::BinaryOperator
op );
101
102
protected
:
103
110
virtual
QString quotedIdentifier(
const
QString &identifier );
111
119
virtual
QString quotedValue(
const
QVariant &value,
bool
&ok );
120
127
virtual
Result
compileNode(
const
QgsExpressionNode
*node, QString &str );
128
135
virtual
QString sqlFunctionFromFunctionName(
const
QString &fnName )
const
;
136
144
virtual
QStringList sqlArgumentsFromFunctionName(
const
QString &fnName,
const
QStringList &fnArgs )
const
;
145
151
virtual
QString castToReal(
const
QString &value )
const
;
152
168
virtual
QString castToText(
const
QString &value )
const
;
169
174
virtual
QString castToInt(
const
QString &value )
const
;
175
181
virtual
Result
replaceNodeByStaticCachedValueIfPossible(
const
QgsExpressionNode
*node, QString &str );
182
183
QString
mResult
;
184
QgsFields
mFields
;
185
186
private
:
187
188
Flags
mFlags;
189
190
bool
mIgnoreStaticNodes =
false
;
191
192
bool
nodeIsNullLiteral(
const
QgsExpressionNode
*node )
const
;
193
194
};
195
196
Q_DECLARE_OPERATORS_FOR_FLAGS
(
QgsSqlExpressionCompiler::Flags
)
197
198
#endif
// QGSSQLEXPRESSIONCOMPILER_H
QgsExpressionNodeBinaryOperator::BinaryOperator
BinaryOperator
list of binary operators
Definition
qgsexpressionnodeimpl.h:108
QgsExpressionNode
Abstract base class for all nodes that can appear in an expression.
Definition
qgsexpressionnode.h:35
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition
qgsexpression.h:189
QgsFields
Container of fields for a vector layer.
Definition
qgsfields.h:46
QgsSqlExpressionCompiler
Generic expression compiler for translation to provider specific SQL WHERE clauses.
Definition
qgssqlexpressioncompiler.h:40
QgsSqlExpressionCompiler::Flags
QFlags< Flag > Flags
Definition
qgssqlexpressioncompiler.h:63
QgsSqlExpressionCompiler::mResult
QString mResult
Definition
qgssqlexpressioncompiler.h:183
QgsSqlExpressionCompiler::mFields
QgsFields mFields
Definition
qgssqlexpressioncompiler.h:184
QgsSqlExpressionCompiler::Result
Result
Possible results from expression compilation.
Definition
qgssqlexpressioncompiler.h:45
QgsSqlExpressionCompiler::Complete
@ Complete
Expression was successfully compiled and can be completely delegated to provider.
Definition
qgssqlexpressioncompiler.h:47
QgsSqlExpressionCompiler::Partial
@ Partial
Expression was partially compiled, but provider will return extra records and results must be double-...
Definition
qgssqlexpressioncompiler.h:48
QgsSqlExpressionCompiler::None
@ None
No expression.
Definition
qgssqlexpressioncompiler.h:46
QgsSqlExpressionCompiler::~QgsSqlExpressionCompiler
virtual ~QgsSqlExpressionCompiler()=default
QgsSqlExpressionCompiler::Flag
Flag
Enumeration of flags for how provider handles SQL clauses.
Definition
qgssqlexpressioncompiler.h:56
qgsexpressionnodeimpl.h
qgsfields.h
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
Generated on Thu Dec 26 2024 02:19:01 for QGIS API Documentation by
1.9.8