QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Class for parsing SQL statements. More...
#include <qgssqlstatement.h>
Classes | |
class | Node |
Abstract node class. More... | |
class | NodeBetweenOperator |
'X BETWEEN y and z' operator More... | |
class | NodeBinaryOperator |
Binary logical/arithmetical operator (AND, OR, =, +, ...) More... | |
class | NodeCast |
CAST operator. More... | |
class | NodeColumnRef |
Reference to a column. More... | |
class | NodeColumnSorted |
Column in a ORDER BY. More... | |
class | NodeFunction |
Function with a name and arguments node. More... | |
class | NodeInOperator |
'x IN (y, z)' operator More... | |
class | NodeJoin |
Join definition. More... | |
class | NodeList |
List of nodes. More... | |
class | NodeLiteral |
Literal value (integer, integer64, double, string) More... | |
class | NodeSelect |
SELECT node. More... | |
class | NodeSelectedColumn |
Selected column. More... | |
class | NodeTableDef |
Table definition. More... | |
class | NodeUnaryOperator |
Unary logicial/arithmetical operator ( NOT, - ) More... | |
class | RecursiveVisitor |
A visitor that recursively explores all children. More... | |
class | Visitor |
Support for visitor pattern - algorithms dealing with the statement may be implemented without modifying the Node classes. More... | |
Public Types | |
enum | BinaryOperator { boOr, boAnd, boEQ, boNE, boLE, boGE, boLT, boGT, boLike, boNotLike, boILike, boNotILike, boIs, boIsNot, boPlus, boMinus, boMul, boDiv, boIntDiv, boMod, boPow, boConcat } |
list of binary operators More... | |
enum | JoinType { jtDefault, jtLeft, jtLeftOuter, jtRight, jtRightOuter, jtCross, jtInner, jtFull } |
list of join types More... | |
enum | NodeType { ntUnaryOperator, ntBinaryOperator, ntInOperator, ntBetweenOperator, ntFunction, ntLiteral, ntColumnRef, ntSelectedColumn, ntSelect, ntTableDef, ntJoin, ntColumnSorted, ntCast } |
Node type. More... | |
enum | UnaryOperator { uoNot, uoMinus } |
list of unary operators More... | |
Public Member Functions | |
QgsSQLStatement (const QString &statement) | |
Creates a new statement based on the provided string. More... | |
QgsSQLStatement (const QgsSQLStatement &other) | |
Create a copy of this statement. More... | |
~QgsSQLStatement () | |
void | acceptVisitor (Visitor &v) const |
Entry function for the visitor pattern. More... | |
bool | doBasicValidationChecks (QString &errorMsgOut) const |
Performs basic validity checks. More... | |
QString | dump () const |
Return statement string, constructed from the internal abstract syntax tree. More... | |
bool | hasParserError () const |
Returns true if an error occurred when parsing the input statement. More... | |
QgsSQLStatement & | operator= (const QgsSQLStatement &other) |
Create a copy of this statement. More... | |
QString | parserErrorString () const |
Returns parser error. More... | |
const Node * | rootNode () const |
Returns root node of the statement. Root node is null is parsing has failed. More... | |
QString | statement () const |
Return the original, unmodified statement string. More... | |
Static Public Member Functions | |
static QString | quotedIdentifier (QString name) |
Returns a quoted column reference (in double quotes) More... | |
static QString | quotedIdentifierIfNeeded (QString name) |
Returns a quoted column reference (in double quotes) if needed, or otherwise the original string. More... | |
static QString | quotedString (QString text) |
Returns a quoted version of a string (in single quotes) More... | |
static QString | stripQuotedIdentifier (QString text) |
Remove double quotes from an identifier. More... | |
Static Public Attributes | |
static const char * | BinaryOperatorText [] |
static const char * | JoinTypeText [] |
static const char * | UnaryOperatorText [] |
Protected Attributes | |
QString | mParserErrorString |
QgsSQLStatement::Node * | mRootNode |
QString | mStatement |
Class for parsing SQL statements.
Definition at line 32 of file qgssqlstatement.h.
list of binary operators
Enumerator | |
---|---|
boOr | |
boAnd | |
boEQ | |
boNE | |
boLE | |
boGE | |
boLT | |
boGT | |
boLike | |
boNotLike | |
boILike | |
boNotILike | |
boIs | |
boIsNot | |
boPlus | |
boMinus | |
boMul | |
boDiv | |
boIntDiv | |
boMod | |
boPow | |
boConcat |
Definition at line 112 of file qgssqlstatement.h.
list of join types
Enumerator | |
---|---|
jtDefault | |
jtLeft | |
jtLeftOuter | |
jtRight | |
jtRightOuter | |
jtCross | |
jtInner | |
jtFull |
Definition at line 149 of file qgssqlstatement.h.
Node type.
Enumerator | |
---|---|
ntUnaryOperator | |
ntBinaryOperator | |
ntInOperator | |
ntBetweenOperator | |
ntFunction | |
ntLiteral | |
ntColumnRef | |
ntSelectedColumn | |
ntSelect | |
ntTableDef | |
ntJoin | |
ntColumnSorted | |
ntCast |
Definition at line 175 of file qgssqlstatement.h.
list of unary operators
Enumerator | |
---|---|
uoNot | |
uoMinus |
Definition at line 102 of file qgssqlstatement.h.
QgsSQLStatement::QgsSQLStatement | ( | const QString & | statement | ) |
Creates a new statement based on the provided string.
Definition at line 117 of file qgssqlstatement.cpp.
QgsSQLStatement::QgsSQLStatement | ( | const QgsSQLStatement & | other | ) |
Create a copy of this statement.
Definition at line 123 of file qgssqlstatement.cpp.
QgsSQLStatement::~QgsSQLStatement | ( | ) |
Definition at line 141 of file qgssqlstatement.cpp.
void QgsSQLStatement::acceptVisitor | ( | QgsSQLStatement::Visitor & | v | ) | const |
Entry function for the visitor pattern.
Definition at line 150 of file qgssqlstatement.cpp.
bool QgsSQLStatement::doBasicValidationChecks | ( | QString & | errorMsgOut | ) | const |
Performs basic validity checks.
Basically checking that columns referencing a table, references a specified table. Returns true if the validation is successful
Definition at line 223 of file qgssqlstatement.cpp.
QString QgsSQLStatement::dump | ( | ) | const |
Return statement string, constructed from the internal abstract syntax tree.
This does not contain any nice whitespace formatting or comments. In general it is preferrable to use statement() instead.
Definition at line 61 of file qgssqlstatement.cpp.
bool QgsSQLStatement::hasParserError | ( | ) | const |
Returns true if an error occurred when parsing the input statement.
Definition at line 146 of file qgssqlstatement.cpp.
QgsSQLStatement & QgsSQLStatement::operator= | ( | const QgsSQLStatement & | other | ) |
Create a copy of this statement.
Definition at line 129 of file qgssqlstatement.cpp.
QString QgsSQLStatement::parserErrorString | ( | ) | const |
Returns parser error.
Definition at line 148 of file qgssqlstatement.cpp.
Returns a quoted column reference (in double quotes)
Definition at line 69 of file qgssqlstatement.cpp.
Returns a quoted column reference (in double quotes) if needed, or otherwise the original string.
Definition at line 74 of file qgssqlstatement.cpp.
Returns a quoted version of a string (in single quotes)
Definition at line 108 of file qgssqlstatement.cpp.
const QgsSQLStatement::Node * QgsSQLStatement::rootNode | ( | ) | const |
Returns root node of the statement. Root node is null is parsing has failed.
Definition at line 156 of file qgssqlstatement.cpp.
QString QgsSQLStatement::statement | ( | ) | const |
Return the original, unmodified statement string.
If there was none supplied because it was constructed by sole API calls, dump() will be used to create one instead.
Definition at line 53 of file qgssqlstatement.cpp.
Remove double quotes from an identifier.
Definition at line 95 of file qgssqlstatement.cpp.
|
static |
Definition at line 162 of file qgssqlstatement.h.
|
static |
Definition at line 168 of file qgssqlstatement.h.
|
protected |
Definition at line 752 of file qgssqlstatement.h.
|
protected |
Definition at line 750 of file qgssqlstatement.h.
|
protected |
Definition at line 751 of file qgssqlstatement.h.
|
static |
Definition at line 165 of file qgssqlstatement.h.