|
QGIS API Documentation 3.99.0-Master (d270888f95f)
|
Parses SQL statements. More...
#include <qgssqlstatement.h>

Classes | |
| class | Node |
| Abstract node class for SQL statement nodes. More... | |
| class | NodeBetweenOperator |
| An '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 |
| An 'x IN (y, z)' operator. More... | |
| class | NodeJoin |
| Join definition. More... | |
| class | NodeList |
| A 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 logical/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 QgsSQLStatement &other) | |
| QgsSQLStatement (const QString &statement) | |
| Creates a new statement based on the provided string. | |
| virtual | ~QgsSQLStatement () |
| void | acceptVisitor (QgsSQLStatement::Visitor &v) const |
| Entry function for the visitor pattern. | |
| bool | doBasicValidationChecks (QString &errorMsgOut) const |
| Performs basic validity checks. | |
| QString | dump () const |
| Returns the statement string, constructed from the internal abstract syntax tree. | |
| bool | hasParserError () const |
Returns true if an error occurred when parsing the input statement. | |
| QgsSQLStatement & | operator= (const QgsSQLStatement &other) |
| QString | parserErrorString () const |
| Returns parser error. | |
| const QgsSQLStatement::Node * | rootNode () const |
| Returns the root node of the statement. | |
| QString | statement () const |
| Returns the original, unmodified statement string. | |
Static Public Member Functions | |
| static QString | quotedIdentifier (QString name) |
| Returns a quoted column reference (in double quotes). | |
| static QString | quotedIdentifierIfNeeded (const QString &name) |
| Returns a quoted column reference (in double quotes) if needed, or otherwise the original string. | |
| static QString | quotedString (QString text) |
| Returns a quoted version of a string (in single quotes). | |
| static QString | stripMsQuotedIdentifier (QString text) |
| Remove double quotes from an Microsoft style identifier. | |
| static QString | stripQuotedIdentifier (QString text) |
| Remove double quotes from an identifier. | |
Static Public Attributes | |
| static const char * | BINARY_OPERATOR_TEXT [] |
| static const char * | JOIN_TYPE_TEXT [] |
| static const char * | UNARY_OPERATOR_TEXT [] |
Protected Member Functions | |
| QgsSQLStatement (const QString &statement, bool allowFragments) | |
| Constructor for QgsSQLStatement, with the specified statement. | |
Protected Attributes | |
| bool | mAllowFragments = false |
| QString | mParserErrorString |
| std::unique_ptr< QgsSQLStatement::Node > | mRootNode |
| QString | mStatement |
Parses SQL statements.
Definition at line 36 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 134 of file qgssqlstatement.h.
list of join types
| Enumerator | |
|---|---|
| jtDefault | |
| jtLeft | |
| jtLeftOuter | |
| jtRight | |
| jtRightOuter | |
| jtCross | |
| jtInner | |
| jtFull | |
Definition at line 171 of file qgssqlstatement.h.
Node type.
| Enumerator | |
|---|---|
| ntUnaryOperator | |
| ntBinaryOperator | |
| ntInOperator | |
| ntBetweenOperator | |
| ntFunction | |
| ntLiteral | |
| ntColumnRef | |
| ntSelectedColumn | |
| ntSelect | |
| ntTableDef | |
| ntJoin | |
| ntColumnSorted | |
| ntCast | |
Definition at line 197 of file qgssqlstatement.h.
list of unary operators
| Enumerator | |
|---|---|
| uoNot | |
| uoMinus | |
Definition at line 124 of file qgssqlstatement.h.
| QgsSQLStatement::QgsSQLStatement | ( | const QString & | statement | ) |
Creates a new statement based on the provided string.
Definition at line 134 of file qgssqlstatement.cpp.
| QgsSQLStatement::QgsSQLStatement | ( | const QgsSQLStatement & | other | ) |
Definition at line 146 of file qgssqlstatement.cpp.
|
virtual |
Definition at line 165 of file qgssqlstatement.cpp.
|
protected |
Constructor for QgsSQLStatement, with the specified statement.
If allowFragments is true then the parser will allow SQL fragments, such as a expression or filter where clause alone.
Definition at line 139 of file qgssqlstatement.cpp.
| void QgsSQLStatement::acceptVisitor | ( | QgsSQLStatement::Visitor & | v | ) | const |
Entry function for the visitor pattern.
Definition at line 174 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 256 of file qgssqlstatement.cpp.
| QString QgsSQLStatement::dump | ( | ) | const |
Returns the statement string, constructed from the internal abstract syntax tree.
This does not contain any nice whitespace formatting or comments. In general it is preferable to use statement() instead.
Definition at line 67 of file qgssqlstatement.cpp.
| bool QgsSQLStatement::hasParserError | ( | ) | const |
Returns true if an error occurred when parsing the input statement.
Definition at line 170 of file qgssqlstatement.cpp.
| QgsSQLStatement & QgsSQLStatement::operator= | ( | const QgsSQLStatement & | other | ) |
Definition at line 153 of file qgssqlstatement.cpp.
| QString QgsSQLStatement::parserErrorString | ( | ) | const |
Returns parser error.
Definition at line 172 of file qgssqlstatement.cpp.
|
static |
Returns a quoted column reference (in double quotes).
Definition at line 75 of file qgssqlstatement.cpp.
|
static |
Returns a quoted column reference (in double quotes) if needed, or otherwise the original string.
Definition at line 80 of file qgssqlstatement.cpp.
|
static |
Returns a quoted version of a string (in single quotes).
Definition at line 125 of file qgssqlstatement.cpp.
| const QgsSQLStatement::Node * QgsSQLStatement::rootNode | ( | ) | const |
Returns the root node of the statement.
The root node is nullptr if parsing has failed.
Definition at line 180 of file qgssqlstatement.cpp.
| QString QgsSQLStatement::statement | ( | ) | const |
Returns 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 59 of file qgssqlstatement.cpp.
|
static |
Remove double quotes from an Microsoft style identifier.
Definition at line 115 of file qgssqlstatement.cpp.
|
static |
Remove double quotes from an identifier.
Definition at line 102 of file qgssqlstatement.cpp.
|
static |
Definition at line 36 of file qgssqlstatement.h.
|
static |
Definition at line 51 of file qgssqlstatement.h.
|
protected |
Definition at line 931 of file qgssqlstatement.h.
|
protected |
Definition at line 933 of file qgssqlstatement.h.
|
protected |
Definition at line 930 of file qgssqlstatement.h.
|
protected |
Definition at line 932 of file qgssqlstatement.h.
|
static |
Definition at line 45 of file qgssqlstatement.h.