25 #include <QMessageBox> 28 #include <Qsci/qscilexer.h> 31 : QDialog( parent, fl )
34 connect( mTablesCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mTablesCombo_currentIndexChanged );
35 connect( mColumnsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mColumnsCombo_currentIndexChanged );
36 connect( mSpatialPredicatesCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mSpatialPredicatesCombo_currentIndexChanged );
37 connect( mFunctionsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mFunctionsCombo_currentIndexChanged );
38 connect( mOperatorsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mOperatorsCombo_currentIndexChanged );
39 connect( mAddJoinButton, &QPushButton::clicked,
this, &QgsSQLComposerDialog::mAddJoinButton_clicked );
40 connect( mRemoveJoinButton, &QPushButton::clicked,
this, &QgsSQLComposerDialog::mRemoveJoinButton_clicked );
41 connect( mTableJoins, &QTableWidget::itemSelectionChanged,
this, &QgsSQLComposerDialog::mTableJoins_itemSelectionChanged );
43 mQueryEdit->setWrapMode( QsciScintilla::WrapWord );
44 mQueryEdit->installEventFilter(
this );
45 mColumnsEditor->installEventFilter(
this );
46 mTablesEditor->installEventFilter(
this );
47 mTableJoins->installEventFilter(
this );
48 mWhereEditor->installEventFilter(
this );
49 mOrderEditor->installEventFilter(
this );
50 mTablesCombo->view()->installEventFilter(
this );
53 connect( mButtonBox->button( QDialogButtonBox::Reset ), &QAbstractButton::clicked,
54 this, &QgsSQLComposerDialog::reset );
56 connect( mQueryEdit, &QsciScintilla::textChanged,
57 this, &QgsSQLComposerDialog::splitSQLIntoFields );
58 connect( mColumnsEditor, &QTextEdit::textChanged,
59 this, &QgsSQLComposerDialog::buildSQLFromFields );
60 connect( mTablesEditor, &QLineEdit::textChanged,
61 this, &QgsSQLComposerDialog::buildSQLFromFields );
62 connect( mWhereEditor, &QTextEdit::textChanged,
63 this, &QgsSQLComposerDialog::buildSQLFromFields );
64 connect( mOrderEditor, &QTextEdit::textChanged,
65 this, &QgsSQLComposerDialog::buildSQLFromFields );
66 connect( mTableJoins, &QTableWidget::cellChanged,
67 this, &QgsSQLComposerDialog::buildSQLFromFields );
68 connect( mButtonBox, &QDialogButtonBox::helpRequested,
69 this, &QgsSQLComposerDialog::showHelp );
72 baseList << QStringLiteral(
"SELECT" );
73 baseList << QStringLiteral(
"FROM" );
74 baseList << QStringLiteral(
"JOIN" );
75 baseList << QStringLiteral(
"ON" );
76 baseList << QStringLiteral(
"USING" );
77 baseList << QStringLiteral(
"WHERE" );
78 baseList << QStringLiteral(
"AND" );
79 baseList << QStringLiteral(
"OR" );
80 baseList << QStringLiteral(
"NOT" );
81 baseList << QStringLiteral(
"IS" );
82 baseList << QStringLiteral(
"NULL" );
83 baseList << QStringLiteral(
"LIKE" );
84 baseList << QStringLiteral(
"ORDER" );
85 baseList << QStringLiteral(
"BY" );
88 QStringList operatorsList;
89 operatorsList << QStringLiteral(
"AND" );
90 operatorsList << QStringLiteral(
"OR" );
91 operatorsList << QStringLiteral(
"NOT" );
92 operatorsList << QStringLiteral(
"=" );
93 operatorsList << QStringLiteral(
"<" );
94 operatorsList << QStringLiteral(
"<=" );
95 operatorsList << QStringLiteral(
">" );
96 operatorsList << QStringLiteral(
">=" );
97 operatorsList << QStringLiteral(
"<>" );
98 operatorsList << QStringLiteral(
"IS" );
99 operatorsList << QStringLiteral(
"IS NOT" );
100 operatorsList << QStringLiteral(
"IN" );
101 operatorsList << QStringLiteral(
"LIKE" );
102 operatorsList << QStringLiteral(
"BETWEEN" );
105 mAggregatesCombo->hide();
106 mFunctionsCombo->hide();
107 mSpatialPredicatesCombo->hide();
108 mStringFunctionsCombo->hide();
110 delete mPageColumnsValues;
111 mPageColumnsValues =
nullptr;
113 mRemoveJoinButton->setEnabled(
false );
115 mTableJoins->setRowCount( 0 );
116 mTableJoins->setItem( 0, 0,
new QTableWidgetItem( QString() ) );
117 mTableJoins->setItem( 0, 1,
new QTableWidgetItem( QString() ) );
125 delete mQueryEdit->lexer()->apis();
126 mQueryEdit->lexer()->setAPIs(
nullptr );
131 if ( event->type() == QEvent::FocusIn )
133 if ( obj == mTablesCombo->view() )
134 lastSearchedText.clear();
136 mFocusedObject = obj;
140 if ( event->type() == QEvent::KeyPress && obj == mTablesCombo->view() )
142 QString currentString = ( ( QKeyEvent * )event )->text();
143 if ( !currentString.isEmpty() && ( ( currentString[0] >=
'a' && currentString[0] <=
'z' ) ||
144 ( currentString[0] >=
'A' && currentString[0] <=
'Z' ) ||
145 ( currentString[0] >=
'0' && currentString[0] <=
'9' ) ||
146 currentString[0] ==
':' || currentString[0] ==
'_' || currentString[0] ==
' ' ||
147 currentString[0] ==
'(' || currentString[0] ==
')' ) )
151 int attemptCount = ( lastSearchedText.isEmpty() ) ? 1 : 2;
152 for (
int attempt = 0; attempt < attemptCount; attempt ++ )
155 lastSearchedText += currentString;
157 lastSearchedText = currentString;
162 int iBestCandidate = 0;
163 int idxInTextOfBestCandidate = 1000;
164 for (
int i = 1; i < mTablesCombo->count(); i++ )
166 int idxInText = mTablesCombo->itemText( i ).indexOf( lastSearchedText, Qt::CaseInsensitive );
167 if ( idxInText >= 0 && idxInText < idxInTextOfBestCandidate )
170 idxInTextOfBestCandidate = idxInText;
173 if ( iBestCandidate > 0 )
175 mTablesCombo->view()->setCurrentIndex( mTablesCombo->model()->index( 0, 0 ).sibling( iBestCandidate, 0 ) );
179 lastSearchedText.clear();
183 return QDialog::eventFilter( obj, event );
188 mTableSelectedCallback = tableSelectedCallback;
193 mSQLValidatorCallback = sqlValidatorCallback;
199 mQueryEdit->setText( sql );
204 return mQueryEdit->text();
207 void QgsSQLComposerDialog::accept()
209 if ( mSQLValidatorCallback )
211 QString errorMsg, warningMsg;
212 if ( !mSQLValidatorCallback->
isValid(
sql(), errorMsg, warningMsg ) )
214 if ( errorMsg.isEmpty() )
215 errorMsg = tr(
"An error occurred during evaluation of the SQL statement." );
216 QMessageBox::critical(
this, tr(
"SQL Evaluation" ), errorMsg );
219 if ( !warningMsg.isEmpty() )
221 QMessageBox::warning(
this, tr(
"SQL Evaluation" ), warningMsg );
227 void QgsSQLComposerDialog::buildSQLFromFields()
229 if ( mAlreadyModifyingFields )
231 mAlreadyModifyingFields =
true;
232 QString
sql( QStringLiteral(
"SELECT " ) );
234 sql += QLatin1String(
"DISTINCT " );
235 sql += mColumnsEditor->toPlainText();
236 sql += QLatin1String(
" FROM " );
237 sql += mTablesEditor->text();
239 int rows = mTableJoins->rowCount();
240 for (
int i = 0; i < rows; i++ )
242 QTableWidgetItem *itemTable = mTableJoins->item( i, 0 );
243 QTableWidgetItem *itemOn = mTableJoins->item( i, 1 );
244 if ( itemTable && !itemTable->text().isEmpty() &&
245 itemOn && !itemOn->text().isEmpty() )
247 sql += QLatin1String(
" JOIN " );
248 sql += itemTable->text();
249 sql += QLatin1String(
" ON " );
250 sql += itemOn->text();
254 if ( !mWhereEditor->toPlainText().isEmpty() )
256 sql += QLatin1String(
" WHERE " );
257 sql += mWhereEditor->toPlainText();
259 if ( !mOrderEditor->toPlainText().isEmpty() )
261 sql += QLatin1String(
" ORDER BY " );
262 sql += mOrderEditor->toPlainText();
264 mQueryEdit->setText( sql );
266 mAlreadyModifyingFields =
false;
269 void QgsSQLComposerDialog::splitSQLIntoFields()
271 if ( mAlreadyModifyingFields )
274 if (
sql.hasParserError() )
280 QList<QgsSQLStatement::NodeSelectedColumn *> columns = nodeSelect->
columns();
284 if ( !columnText.isEmpty() )
285 columnText += QLatin1String(
", " );
286 columnText += column->
dump();
289 QList<QgsSQLStatement::NodeTableDef *> tables = nodeSelect->
tables();
293 if ( !tablesText.isEmpty() )
294 tablesText += QLatin1String(
", " );
296 tablesText += table->
dump();
302 whereText = where->
dump();
305 QList<QgsSQLStatement::NodeColumnSorted *> orderColumns = nodeSelect->
orderBy();
308 if ( !orderText.isEmpty() )
309 orderText += QLatin1String(
", " );
310 orderText += column->
dump();
313 QList<QgsSQLStatement::NodeJoin *> joins = nodeSelect->
joins();
315 mAlreadyModifyingFields =
true;
316 mColumnsEditor->setPlainText( columnText );
317 mTablesEditor->setText( tablesText );
318 mWhereEditor->setPlainText( whereText );
319 mOrderEditor->setPlainText( orderText );
321 mTableJoins->setRowCount( joins.size() + 1 );
326 mTableJoins->setItem( iRow, 0,
new QTableWidgetItem( join->
tableDef()->
dump() ) );
328 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( join->
onExpr()->
dump() ) );
330 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( QString() ) );
333 mTableJoins->setItem( iRow, 0,
new QTableWidgetItem( QString() ) );
334 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( QString() ) );
336 mAlreadyModifyingFields =
false;
341 Q_FOREACH (
const QString &name, list )
342 mapTableEntryTextToName[name] = name;
343 mTablesCombo->addItems( list );
349 QStringList listCombo;
353 listApi << pair.first;
354 QString entryText( pair.first );
355 if ( !pair.second.isEmpty() && pair.second != pair.first )
357 if ( pair.second.size() < 40 )
358 entryText +=
" (" + pair.second +
")";
360 entryText +=
" (" + pair.second.mid( 0, 20 ) + QChar( 0x2026 ) + pair.second.mid( pair.second.size() - 20 ) +
")";
362 listCombo << entryText;
363 mapTableEntryTextToName[entryText] = pair.first;
365 mTablesCombo->addItems( listCombo );
371 QList<PairNameType> listPair;
372 Q_FOREACH (
const QString &name, list )
377 static QString sanitizeType( QString type )
379 if ( type.startsWith( QLatin1String(
"xs:" ) ) )
380 return type.mid( 3 );
381 if ( type.startsWith( QLatin1String(
"xsd:" ) ) )
382 return type.mid( 4 );
383 if ( type == QLatin1String(
"gml:AbstractGeometryType" ) )
384 return QStringLiteral(
"geometry" );
390 mAlreadySelectedTables.insert( tableName );
391 if ( mColumnsCombo->count() > 1 )
392 mColumnsCombo->insertSeparator( mColumnsCombo->count() );
394 QStringList listCombo;
398 listApi << pair.first;
399 QString entryText( pair.first );
400 if ( !pair.second.isEmpty() )
402 entryText +=
" (" + sanitizeType( pair.second ) +
")";
404 listCombo << entryText;
405 mapColumnEntryTextToName[entryText] = pair.first;
407 mColumnsCombo->addItems( listCombo );
414 mOperatorsCombo->addItems( list );
422 return QObject::tr(
"%1 to %2 arguments" ).arg( f.
minArgs ).arg( f.
maxArgs );
430 return QObject::tr(
"1 argument" );
432 return QObject::tr(
"%1 arguments" ).arg( f.
minArgs );
437 return QObject::tr(
"%1 arguments or more" ).arg( f.
minArgs );
439 return QObject::tr(
"1 argument or more" );
441 return QObject::tr(
"0 argument or more" );
447 void QgsSQLComposerDialog::getFunctionList(
const QList<Function> &list,
448 QStringList &listApi,
449 QStringList &listCombo,
450 QMap<QString, QString> &mapEntryTextToName )
452 Q_FOREACH (
const Function &f, list )
455 QString entryText( f.
name );
456 entryText += QLatin1String(
"(" );
461 if ( f.
minArgs >= 0 && i >= f.
minArgs ) entryText += QLatin1String(
"[" );
462 if ( i > 0 ) entryText += QLatin1String(
", " );
470 QString sanitizedType( sanitizeType( f.
argumentList[i].type ) );
474 entryText += QLatin1String(
": " );
475 entryText += sanitizedType;
478 if ( f.
minArgs >= 0 && i >= f.
minArgs ) entryText += QLatin1String(
"]" );
480 if ( entryText.size() > 60 )
483 entryText += QLatin1String(
"(" );
484 entryText += getFunctionAbbridgedParameters( f );
489 entryText += getFunctionAbbridgedParameters( f );
491 entryText += QLatin1String(
")" );
493 entryText +=
": " + sanitizeType( f.
returnType );
494 listCombo << entryText;
495 mapEntryTextToName[entryText] = f.
name +
"(";
501 QList<Function> listFunction;
502 Q_FOREACH (
const QString &name, list )
514 QStringList listCombo;
515 getFunctionList( list, listApi, listCombo, mapSpatialPredicateEntryTextToName );
516 mSpatialPredicatesCombo->addItems( listCombo );
517 mSpatialPredicatesCombo->show();
523 QList<Function> listFunction;
524 Q_FOREACH (
const QString &name, list )
536 QStringList listCombo;
537 getFunctionList( list, listApi, listCombo, mapFunctionEntryTextToName );
538 mFunctionsCombo->addItems( listCombo );
539 mFunctionsCombo->show();
543 void QgsSQLComposerDialog::loadTableColumns(
const QString &table )
545 if ( mTableSelectedCallback )
547 if ( !mAlreadySelectedTables.contains( table ) )
550 mAlreadySelectedTables.insert( table );
555 static void resetCombo( QComboBox *combo )
562 QMetaObject::invokeMethod( combo,
"setCurrentIndex", Qt::QueuedConnection, Q_ARG(
int, 0 ) );
565 void QgsSQLComposerDialog::mTablesCombo_currentIndexChanged(
int )
567 int index = mTablesCombo->currentIndex();
570 QObject *obj = mFocusedObject;
571 QString newText = mapTableEntryTextToName[mTablesCombo->currentText()];
572 loadTableColumns( newText );
573 if ( obj == mTablesEditor )
575 QString currentText = mTablesEditor->text();
576 if ( currentText.isEmpty() )
577 mTablesEditor->setText( newText );
579 mTablesEditor->setText( currentText +
", " + newText );
581 else if ( obj == mTableJoins )
583 if ( mTableJoins->selectedItems().size() == 1 )
585 mTableJoins->selectedItems().at( 0 )->setText( newText );
588 else if ( obj == mWhereEditor )
590 mWhereEditor->insertPlainText( newText );
592 else if ( obj == mOrderEditor )
594 mOrderEditor->insertPlainText( newText );
596 else if ( obj == mQueryEdit )
598 mQueryEdit->insertText( newText );
600 resetCombo( mTablesCombo );
603 void QgsSQLComposerDialog::mColumnsCombo_currentIndexChanged(
int )
605 int index = mColumnsCombo->currentIndex();
608 QObject *obj = mFocusedObject;
609 QString newText = mapColumnEntryTextToName[mColumnsCombo->currentText()];
610 if ( obj == mColumnsEditor )
612 QString currentText = mColumnsEditor->toPlainText();
613 if ( currentText.isEmpty() )
614 mColumnsEditor->insertPlainText( newText );
616 mColumnsEditor->insertPlainText(
",\n" + newText );
618 else if ( obj == mTableJoins )
620 if ( mTableJoins->selectedItems().size() == 1 &&
621 mTableJoins->selectedItems().at( 0 )->column() == 1 )
623 QString currentText( mTableJoins->selectedItems().at( 0 )->text() );
624 if ( !currentText.isEmpty() && !currentText.contains( QLatin1String(
"=" ) ) )
625 mTableJoins->selectedItems().at( 0 )->setText( currentText +
" = " + newText );
627 mTableJoins->selectedItems().at( 0 )->setText( currentText + newText );
630 else if ( obj == mWhereEditor )
632 mWhereEditor->insertPlainText( newText );
634 else if ( obj == mOrderEditor )
636 mOrderEditor->insertPlainText( newText );
638 else if ( obj == mQueryEdit )
640 mQueryEdit->insertText( newText );
642 resetCombo( mColumnsCombo );
645 void QgsSQLComposerDialog::mFunctionsCombo_currentIndexChanged(
int )
647 functionCurrentIndexChanged( mFunctionsCombo, mapFunctionEntryTextToName );
650 void QgsSQLComposerDialog::mSpatialPredicatesCombo_currentIndexChanged(
int )
652 functionCurrentIndexChanged( mSpatialPredicatesCombo, mapSpatialPredicateEntryTextToName );
655 void QgsSQLComposerDialog::functionCurrentIndexChanged( QComboBox *combo,
656 const QMap<QString, QString> &mapEntryTextToName )
658 int index = combo->currentIndex();
661 QObject *obj = mFocusedObject;
662 QString newText = mapEntryTextToName[combo->currentText()];
663 if ( obj == mColumnsEditor )
665 mColumnsEditor->insertPlainText( newText );
667 else if ( obj == mWhereEditor )
669 mWhereEditor->insertPlainText( newText );
671 else if ( obj == mQueryEdit )
673 mQueryEdit->insertText( newText );
678 void QgsSQLComposerDialog::mOperatorsCombo_currentIndexChanged(
int )
680 int index = mOperatorsCombo->currentIndex();
683 QObject *obj = mFocusedObject;
684 QString newText = mOperatorsCombo->currentText();
685 if ( obj == mColumnsEditor )
687 mColumnsEditor->insertPlainText( newText );
689 else if ( obj == mWhereEditor )
691 mWhereEditor->insertPlainText( newText );
693 else if ( obj == mTableJoins )
695 if ( mTableJoins->selectedItems().size() == 1 &&
696 mTableJoins->selectedItems().at( 0 )->column() == 1 )
698 QString currentText( mTableJoins->selectedItems().at( 0 )->text() );
699 mTableJoins->selectedItems().at( 0 )->setText( currentText + newText );
702 else if ( obj == mQueryEdit )
704 mQueryEdit->insertText( newText );
706 resetCombo( mOperatorsCombo );
709 void QgsSQLComposerDialog::mAddJoinButton_clicked()
711 int insertRow = mTableJoins->currentRow();
712 int rowCount = mTableJoins->rowCount();
714 insertRow = rowCount;
715 mTableJoins->setRowCount( rowCount + 1 );
716 for (
int row = rowCount ; row > insertRow + 1; row -- )
718 mTableJoins->setItem( row, 0, mTableJoins->takeItem( row - 1, 0 ) );
719 mTableJoins->setItem( row, 1, mTableJoins->takeItem( row - 1, 1 ) );
721 mTableJoins->setItem( ( insertRow == rowCount ) ? insertRow : insertRow + 1, 0,
new QTableWidgetItem( QString() ) );
722 mTableJoins->setItem( ( insertRow == rowCount ) ? insertRow : insertRow + 1, 1,
new QTableWidgetItem( QString() ) );
725 void QgsSQLComposerDialog::mRemoveJoinButton_clicked()
727 int row = mTableJoins->currentRow();
730 int rowCount = mTableJoins->rowCount();
731 for ( ; row < rowCount - 1; row ++ )
733 mTableJoins->setItem( row, 0, mTableJoins->takeItem( row + 1, 0 ) );
734 mTableJoins->setItem( row, 1, mTableJoins->takeItem( row + 1, 1 ) );
736 mTableJoins->setRowCount( rowCount - 1 );
738 buildSQLFromFields();
741 void QgsSQLComposerDialog::reset()
743 mQueryEdit->setText( mResetSql );
746 void QgsSQLComposerDialog::mTableJoins_itemSelectionChanged()
748 mRemoveJoinButton->setEnabled( mTableJoins->selectedItems().size() == 1 );
755 delete mQueryEdit->lexer()->apis();
756 QsciAPIs *apis =
new QsciAPIs( mQueryEdit->lexer() );
758 Q_FOREACH (
const QString &str, mApiList )
764 mQueryEdit->lexer()->setAPIs( apis );
769 mJoinsLabels->setVisible( on );
770 mTableJoins->setVisible( on );
771 mAddJoinButton->setVisible( on );
772 mRemoveJoinButton->setVisible( on );
773 mTablesCombo->setVisible( on );
775 QString mainTypenameFormatted;
776 if ( !mainTypename.isEmpty() )
777 mainTypenameFormatted =
" (" + mainTypename +
")";
778 mQueryEdit->setToolTip( tr(
"This is the SQL query editor. The SQL statement can select data from several tables, \n" 779 "but it must compulsory include the main typename%1 in the selected tables, \n" 780 "and only the geometry column of the main typename can be used as the geometry column of the resulting layer." ).arg( mainTypenameFormatted ) );
783 void QgsSQLComposerDialog::showHelp()
785 QgsHelp::openHelp( QStringLiteral(
"working_with_ogc/ogc_client_support.html#ogc-wfs" ) );
virtual void tableSelected(const QString &name)=0
method called when a table is selected
void addOperators(const QStringList &list)
add a list of operators
Callback to do actions on table selection.
void addFunctions(const QStringList &list)
add a list of functions
QList< Argument > argumentList
list of arguments. May be empty despite minArgs > 0
QgsSQLStatement::Node * onExpr() const
On expression. Will be nullptr if usingColumns() is not empty.
void setSQLValidatorCallback(SQLValidatorCallback *sqlValidatorCallback)
Set a callback that will be called when the OK button is pushed.
QgsSQLStatement::NodeTableDef * tableDef() const
Table definition.
~QgsSQLComposerDialog() override
QgsSQLStatement::Node * where() const
Returns the where clause.
void addApis(const QStringList &list)
add a list of API for autocompletion
void setTableSelectedCallback(TableSelectedCallback *tableSelectedCallback)
Set a callback that will be called when a new table is selected, so that new column names can be adde...
int maxArgs
maximum number of argument (or -1 if unknown)
void addColumnNames(const QStringList &list, const QString &tableName)
add a list of column names
QList< QgsSQLStatement::NodeSelectedColumn * > columns() const
Returns the list of columns.
bool distinct() const
Returns if the SELECT is DISTINCT.
QPair< QString, QString > PairNameTitle
pair (name, title)
Class for parsing SQL statements.
QString name() const
Table name.
QgsSQLComposerDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
constructor
virtual QString dump() const =0
Abstract virtual dump method.
virtual bool isValid(const QString &sql, QString &errorReason, QString &warningMsg)=0
method should return true if the SQL is valid. Otherwise return false and set the errorReason ...
QPair< QString, QString > PairNameType
pair (name, type)
void addSpatialPredicates(const QStringList &list)
add a list of spatial predicates
QList< QgsSQLStatement::NodeTableDef * > tables() const
Returns the list of tables.
description of server functions
Callback to do validation check on dialog validation.
QString dump() const override
Abstract virtual dump method.
QList< QgsSQLStatement::NodeColumnSorted * > orderBy() const
Returns the list of order by columns.
QString returnType
Returns type, or empty if unknown.
QString sql() const
Gets the SQL statement.
void setSupportMultipleTables(bool bMultipleTables, const QString &mainTypename=QString())
Sets if multiple tables/joins are supported. Default is false.
QList< QgsSQLStatement::NodeJoin * > joins() const
Returns the list of joins.
bool eventFilter(QObject *obj, QEvent *event) override
QString dump() const override
Abstract virtual dump method.
static QString quotedIdentifierIfNeeded(const QString &name)
Returns a quoted column reference (in double quotes) if needed, or otherwise the original string...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
QString dump() const override
Abstract virtual dump method.
void addTableNames(const QStringList &list)
add a list of table names
void setSql(const QString &sql)
initialize the SQL statement
int minArgs
minimum number of argument (or -1 if unknown)