29#include <Qsci/qscilexer.h>
31#include "moc_qgssqlcomposerdialog.cpp"
42 connect( mTablesCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mTablesCombo_currentIndexChanged );
43 connect( mColumnsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mColumnsCombo_currentIndexChanged );
44 connect( mSpatialPredicatesCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mSpatialPredicatesCombo_currentIndexChanged );
45 connect( mFunctionsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mFunctionsCombo_currentIndexChanged );
46 connect( mOperatorsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mOperatorsCombo_currentIndexChanged );
47 connect( mAddJoinButton, &QPushButton::clicked,
this, &QgsSQLComposerDialog::mAddJoinButton_clicked );
48 connect( mRemoveJoinButton, &QPushButton::clicked,
this, &QgsSQLComposerDialog::mRemoveJoinButton_clicked );
49 connect( mTableJoins, &QTableWidget::itemSelectionChanged,
this, &QgsSQLComposerDialog::mTableJoins_itemSelectionChanged );
51 mQueryEdit->setWrapMode( QsciScintilla::WrapWord );
52 mQueryEdit->installEventFilter(
this );
53 mColumnsEditor->installEventFilter(
this );
54 mTablesEditor->installEventFilter(
this );
55 mTableJoins->installEventFilter(
this );
56 mWhereEditor->installEventFilter(
this );
57 mOrderEditor->installEventFilter(
this );
58 mTablesCombo->view()->installEventFilter(
this );
61 connect( mButtonBox->button( QDialogButtonBox::Reset ), &QAbstractButton::clicked,
this, &QgsSQLComposerDialog::reset );
63 connect( mQueryEdit, &QsciScintilla::textChanged,
this, &QgsSQLComposerDialog::splitSQLIntoFields );
64 connect( mColumnsEditor, &QTextEdit::textChanged,
this, &QgsSQLComposerDialog::buildSQLFromFields );
65 connect( mTablesEditor, &QLineEdit::textChanged,
this, &QgsSQLComposerDialog::buildSQLFromFields );
66 connect( mWhereEditor, &QTextEdit::textChanged,
this, &QgsSQLComposerDialog::buildSQLFromFields );
67 connect( mOrderEditor, &QTextEdit::textChanged,
this, &QgsSQLComposerDialog::buildSQLFromFields );
68 connect( mTableJoins, &QTableWidget::cellChanged,
this, &QgsSQLComposerDialog::buildSQLFromFields );
69 connect( mButtonBox, &QDialogButtonBox::helpRequested,
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(
"BETWEEN" );
99 operatorsList << QStringLiteral(
"NOT BETWEEN" );
100 operatorsList << QStringLiteral(
"IS" );
101 operatorsList << QStringLiteral(
"IS NOT" );
102 operatorsList << QStringLiteral(
"IN" );
103 operatorsList << QStringLiteral(
"LIKE" );
106 mAggregatesCombo->hide();
107 mFunctionsCombo->hide();
108 mSpatialPredicatesCombo->hide();
109 mStringFunctionsCombo->hide();
111 delete mPageColumnsValues;
112 mPageColumnsValues =
nullptr;
114 mRemoveJoinButton->setEnabled(
false );
116 mTableJoins->setRowCount( 0 );
117 mTableJoins->setItem( 0, 0,
new QTableWidgetItem( QString() ) );
118 mTableJoins->setItem( 0, 1,
new QTableWidgetItem( QString() ) );
126 delete mQueryEdit->lexer()->apis();
127 mQueryEdit->lexer()->setAPIs(
nullptr );
132 if ( event->type() == QEvent::FocusIn )
134 if ( obj == mTablesCombo->view() )
135 lastSearchedText.clear();
137 mFocusedObject = obj;
141 if ( event->type() == QEvent::KeyPress && obj == mTablesCombo->view() )
143 QString currentString = ( ( QKeyEvent * ) event )->text();
144 if ( !currentString.isEmpty() && ( ( currentString[0] >=
'a' && currentString[0] <=
'z' ) || ( currentString[0] >=
'A' && currentString[0] <=
'Z' ) || ( currentString[0] >=
'0' && currentString[0] <=
'9' ) || currentString[0] ==
':' || currentString[0] ==
'_' || currentString[0] ==
' ' || currentString[0] ==
'(' || currentString[0] ==
')' ) )
148 const int attemptCount = ( lastSearchedText.isEmpty() ) ? 1 : 2;
149 for (
int attempt = 0; attempt < attemptCount; attempt++ )
152 lastSearchedText += currentString;
154 lastSearchedText = currentString;
159 int iBestCandidate = 0;
160 int idxInTextOfBestCandidate = 1000;
161 for (
int i = 1; i < mTablesCombo->count(); i++ )
163 const int idxInText = mTablesCombo->itemText( i ).indexOf( lastSearchedText, Qt::CaseInsensitive );
164 if ( idxInText >= 0 && idxInText < idxInTextOfBestCandidate )
167 idxInTextOfBestCandidate = idxInText;
170 if ( iBestCandidate > 0 )
172 mTablesCombo->view()->setCurrentIndex( mTablesCombo->model()->index( 0, 0 ).sibling( iBestCandidate, 0 ) );
176 lastSearchedText.clear();
180 return QDialog::eventFilter( obj, event );
185 mTableSelectedCallback = tableSelectedCallback;
190 mSQLValidatorCallback = sqlValidatorCallback;
196 mQueryEdit->setText(
sql );
201 return mQueryEdit->text();
204void QgsSQLComposerDialog::accept()
206 if ( mSQLValidatorCallback )
208 QString errorMsg, warningMsg;
209 if ( !mSQLValidatorCallback->
isValid(
sql(), errorMsg, warningMsg ) )
211 if ( errorMsg.isEmpty() )
212 errorMsg = tr(
"An error occurred during evaluation of the SQL statement." );
213 QMessageBox::critical(
this, tr(
"SQL Evaluation" ), errorMsg );
216 if ( !warningMsg.isEmpty() )
218 QMessageBox::warning(
this, tr(
"SQL Evaluation" ), warningMsg );
223 mLayer->setSubsetString(
sql() );
228void QgsSQLComposerDialog::buildSQLFromFields()
230 if ( mAlreadyModifyingFields )
232 mAlreadyModifyingFields =
true;
233 QString
sql( QStringLiteral(
"SELECT " ) );
235 sql += QLatin1String(
"DISTINCT " );
236 sql += mColumnsEditor->toPlainText();
237 sql += QLatin1String(
" FROM " );
238 sql += mTablesEditor->text();
240 const int rows = mTableJoins->rowCount();
241 for (
int i = 0; i < rows; i++ )
243 QTableWidgetItem *itemTable = mTableJoins->item( i, 0 );
244 QTableWidgetItem *itemOn = mTableJoins->item( i, 1 );
245 if ( itemTable && !itemTable->text().isEmpty() && 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;
269void QgsSQLComposerDialog::splitSQLIntoFields()
271 if ( mAlreadyModifyingFields )
273 const QgsSQLStatement
sql( mQueryEdit->text() );
274 if (
sql.hasParserError() )
276 const QgsSQLStatement::NodeSelect *nodeSelect =
dynamic_cast<const QgsSQLStatement::NodeSelect *
>(
sql.rootNode() );
280 const QList<QgsSQLStatement::NodeSelectedColumn *> columns = nodeSelect->
columns();
282 const auto constColumns = columns;
283 for ( QgsSQLStatement::NodeSelectedColumn *column : constColumns )
285 if ( !columnText.isEmpty() )
286 columnText += QLatin1String(
", " );
287 columnText += column->dump();
290 const QList<QgsSQLStatement::NodeTableDef *> tables = nodeSelect->
tables();
292 const auto constTables = tables;
293 for ( QgsSQLStatement::NodeTableDef *table : constTables )
295 if ( !tablesText.isEmpty() )
296 tablesText += QLatin1String(
", " );
298 tablesText += table->dump();
302 QgsSQLStatement::Node *where = nodeSelect->
where();
304 whereText = where->
dump();
307 const QList<QgsSQLStatement::NodeColumnSorted *> orderColumns = nodeSelect->
orderBy();
308 const auto constOrderColumns = orderColumns;
309 for ( QgsSQLStatement::NodeColumnSorted *column : constOrderColumns )
311 if ( !orderText.isEmpty() )
312 orderText += QLatin1String(
", " );
313 orderText += column->dump();
316 const QList<QgsSQLStatement::NodeJoin *> joins = nodeSelect->
joins();
318 mAlreadyModifyingFields =
true;
319 mColumnsEditor->setPlainText( columnText );
320 mTablesEditor->setText( tablesText );
321 mWhereEditor->setPlainText( whereText );
322 mOrderEditor->setPlainText( orderText );
324 mTableJoins->setRowCount( joins.size() + 1 );
326 const auto constJoins = joins;
327 for ( QgsSQLStatement::NodeJoin *join : constJoins )
330 mTableJoins->setItem( iRow, 0,
new QTableWidgetItem( join->tableDef()->dump() ) );
331 if ( join->onExpr() )
332 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( join->onExpr()->dump() ) );
334 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( QString() ) );
337 mTableJoins->setItem( iRow, 0,
new QTableWidgetItem( QString() ) );
338 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( QString() ) );
340 mAlreadyModifyingFields =
false;
345 const auto constList = list;
346 for (
const QString &name : constList )
347 mapTableEntryTextToName[name] = name;
348 mTablesCombo->addItems( list );
354 QStringList listCombo;
356 const auto constListNameTitle = listNameTitle;
359 listApi << pair.first;
360 QString entryText( pair.first );
361 if ( !pair.second.isEmpty() && pair.second != pair.first )
363 if ( pair.second.size() < 40 )
364 entryText +=
" (" + pair.second +
")";
366 entryText +=
" (" + pair.second.mid( 0, 20 ) + QChar( 0x2026 ) + pair.second.mid( pair.second.size() - 20 ) +
")";
368 listCombo << entryText;
369 mapTableEntryTextToName[entryText] = pair.first;
371 mTablesCombo->addItems( listCombo );
377 QList<PairNameType> listPair;
378 const auto constList = list;
379 for (
const QString &name : constList )
384static QString sanitizeType( QString type )
386 if ( type.startsWith( QLatin1String(
"xs:" ) ) )
387 return type.mid( 3 );
388 if ( type.startsWith( QLatin1String(
"xsd:" ) ) )
389 return type.mid( 4 );
390 if ( type == QLatin1String(
"gml:AbstractGeometryType" ) )
391 return QStringLiteral(
"geometry" );
397 mAlreadySelectedTables.insert( tableName );
398 if ( mColumnsCombo->count() > 1 )
399 mColumnsCombo->insertSeparator( mColumnsCombo->count() );
401 QStringList listCombo;
403 const auto constList = list;
406 listApi << pair.first;
407 QString entryText( pair.first );
408 if ( !pair.second.isEmpty() )
410 entryText +=
" (" + sanitizeType( pair.second ) +
")";
412 listCombo << entryText;
413 mapColumnEntryTextToName[entryText] = pair.first;
415 mColumnsCombo->addItems( listCombo );
422 mOperatorsCombo->addItems( list );
430 return QObject::tr(
"%1 to %n argument(s)",
nullptr, f.
maxArgs ).arg( f.
minArgs );
437 return QObject::tr(
"%n argument(s)",
nullptr, f.
minArgs );
441 return QObject::tr(
"%n argument(s) or more",
nullptr, f.
minArgs );
447void QgsSQLComposerDialog::getFunctionList(
const QList<Function> &list, QStringList &listApi, QStringList &listCombo, QMap<QString, QString> &mapEntryTextToName )
449 const auto constList = list;
450 for (
const Function &f : constList )
453 QString entryText( f.
name );
454 entryText += QLatin1Char(
'(' );
460 entryText += QLatin1Char(
'[' );
462 entryText += QLatin1String(
", " );
470 const QString sanitizedType( sanitizeType( f.
argumentList[i].type ) );
473 entryText += QLatin1String(
": " );
474 entryText += sanitizedType;
478 entryText += QLatin1Char(
']' );
480 if ( entryText.size() > 60 )
483 entryText += QLatin1Char(
'(' );
484 entryText += getFunctionAbbridgedParameters( f );
489 entryText += getFunctionAbbridgedParameters( f );
491 entryText += QLatin1Char(
')' );
493 entryText +=
": " + sanitizeType( f.
returnType );
494 listCombo << entryText;
495 mapEntryTextToName[entryText] = f.
name +
"(";
501 QList<Function> listFunction;
502 const auto constList = list;
503 for (
const QString &name : constList )
515 QStringList listCombo;
516 getFunctionList( list, listApi, listCombo, mapSpatialPredicateEntryTextToName );
517 mSpatialPredicatesCombo->addItems( listCombo );
518 mSpatialPredicatesCombo->show();
524 QList<Function> listFunction;
525 const auto constList = list;
526 for (
const QString &name : constList )
538 QStringList listCombo;
539 getFunctionList( list, listApi, listCombo, mapFunctionEntryTextToName );
540 mFunctionsCombo->addItems( listCombo );
541 mFunctionsCombo->show();
545void QgsSQLComposerDialog::loadTableColumns(
const QString &table )
547 if ( mTableSelectedCallback )
549 if ( !mAlreadySelectedTables.contains( table ) )
552 mAlreadySelectedTables.insert( table );
557static void resetCombo( QComboBox *combo )
564 QMetaObject::invokeMethod( combo,
"setCurrentIndex", Qt::QueuedConnection, Q_ARG(
int, 0 ) );
567void QgsSQLComposerDialog::mTablesCombo_currentIndexChanged(
int )
569 const int index = mTablesCombo->currentIndex();
572 QObject *obj = mFocusedObject;
573 const QString newText = mapTableEntryTextToName[mTablesCombo->currentText()];
574 loadTableColumns( newText );
575 if ( obj == mTablesEditor )
577 const QString currentText = mTablesEditor->text();
578 if ( currentText.isEmpty() )
579 mTablesEditor->setText( newText );
581 mTablesEditor->setText( currentText +
", " + newText );
583 else if ( obj == mTableJoins )
585 if ( mTableJoins->selectedItems().size() == 1 )
587 mTableJoins->selectedItems().at( 0 )->setText( newText );
590 else if ( obj == mWhereEditor )
592 mWhereEditor->insertPlainText( newText );
594 else if ( obj == mOrderEditor )
596 mOrderEditor->insertPlainText( newText );
598 else if ( obj == mQueryEdit )
600 mQueryEdit->insertText( newText );
602 resetCombo( mTablesCombo );
605void QgsSQLComposerDialog::mColumnsCombo_currentIndexChanged(
int )
607 const int index = mColumnsCombo->currentIndex();
610 QObject *obj = mFocusedObject;
611 const QString newText = mapColumnEntryTextToName[mColumnsCombo->currentText()];
612 if ( obj == mColumnsEditor )
614 const QString currentText = mColumnsEditor->toPlainText();
615 if ( currentText.isEmpty() )
616 mColumnsEditor->insertPlainText( newText );
618 mColumnsEditor->insertPlainText(
",\n" + newText );
620 else if ( obj == mTableJoins )
622 if ( mTableJoins->selectedItems().size() == 1 && mTableJoins->selectedItems().at( 0 )->column() == 1 )
624 const QString currentText( mTableJoins->selectedItems().at( 0 )->text() );
625 if ( !currentText.isEmpty() && !currentText.contains( QLatin1String(
"=" ) ) )
626 mTableJoins->selectedItems().at( 0 )->setText( currentText +
" = " + newText );
628 mTableJoins->selectedItems().at( 0 )->setText( currentText + newText );
631 else if ( obj == mWhereEditor )
633 mWhereEditor->insertPlainText( newText );
635 else if ( obj == mOrderEditor )
637 mOrderEditor->insertPlainText( newText );
639 else if ( obj == mQueryEdit )
641 mQueryEdit->insertText( newText );
643 resetCombo( mColumnsCombo );
646void QgsSQLComposerDialog::mFunctionsCombo_currentIndexChanged(
int )
648 functionCurrentIndexChanged( mFunctionsCombo, mapFunctionEntryTextToName );
651void QgsSQLComposerDialog::mSpatialPredicatesCombo_currentIndexChanged(
int )
653 functionCurrentIndexChanged( mSpatialPredicatesCombo, mapSpatialPredicateEntryTextToName );
656void QgsSQLComposerDialog::functionCurrentIndexChanged( QComboBox *combo,
const QMap<QString, QString> &mapEntryTextToName )
658 const int index = combo->currentIndex();
661 QObject *obj = mFocusedObject;
662 const 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 );
678void QgsSQLComposerDialog::mOperatorsCombo_currentIndexChanged(
int )
680 const int index = mOperatorsCombo->currentIndex();
683 QObject *obj = mFocusedObject;
684 const 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 && mTableJoins->selectedItems().at( 0 )->column() == 1 )
697 const QString currentText( mTableJoins->selectedItems().at( 0 )->text() );
698 mTableJoins->selectedItems().at( 0 )->setText( currentText + newText );
701 else if ( obj == mQueryEdit )
703 mQueryEdit->insertText( newText );
705 resetCombo( mOperatorsCombo );
708void QgsSQLComposerDialog::mAddJoinButton_clicked()
710 int insertRow = mTableJoins->currentRow();
711 const int rowCount = mTableJoins->rowCount();
713 insertRow = rowCount;
714 mTableJoins->setRowCount( rowCount + 1 );
715 for (
int row = rowCount; row > insertRow + 1; row-- )
717 mTableJoins->setItem( row, 0, mTableJoins->takeItem( row - 1, 0 ) );
718 mTableJoins->setItem( row, 1, mTableJoins->takeItem( row - 1, 1 ) );
720 mTableJoins->setItem( ( insertRow == rowCount ) ? insertRow : insertRow + 1, 0,
new QTableWidgetItem( QString() ) );
721 mTableJoins->setItem( ( insertRow == rowCount ) ? insertRow : insertRow + 1, 1,
new QTableWidgetItem( QString() ) );
724void QgsSQLComposerDialog::mRemoveJoinButton_clicked()
726 int row = mTableJoins->currentRow();
729 const int rowCount = mTableJoins->rowCount();
730 for ( ; row < rowCount - 1; row++ )
732 mTableJoins->setItem( row, 0, mTableJoins->takeItem( row + 1, 0 ) );
733 mTableJoins->setItem( row, 1, mTableJoins->takeItem( row + 1, 1 ) );
735 mTableJoins->setRowCount( rowCount - 1 );
737 buildSQLFromFields();
740void QgsSQLComposerDialog::reset()
742 mQueryEdit->setText( mResetSql );
745void QgsSQLComposerDialog::mTableJoins_itemSelectionChanged()
747 mRemoveJoinButton->setEnabled( mTableJoins->selectedItems().size() == 1 );
754 delete mQueryEdit->lexer()->apis();
755 QsciAPIs *apis =
new QsciAPIs( mQueryEdit->lexer() );
757 const auto constMApiList = mApiList;
758 for (
const QString &str : constMApiList )
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." )
781 .arg( mainTypenameFormatted ) );
784void QgsSQLComposerDialog::showHelp()
786 QgsHelp::openHelp( QStringLiteral(
"working_with_ogc/ogc_client_support.html#ogc-wfs" ) );
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Callback to do validation check on dialog validation.
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
Callback to do actions on table selection.
virtual void tableSelected(const QString &name)=0
method called when a table is selected
bool eventFilter(QObject *obj, QEvent *event) override
QgsSQLComposerDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
constructor
void addSpatialPredicates(const QStringList &list)
add a list of spatial predicates
void setSQLValidatorCallback(SQLValidatorCallback *sqlValidatorCallback)
Set a callback that will be called when the OK button is pushed.
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...
QPair< QString, QString > PairNameType
pair (name, type)
void addOperators(const QStringList &list)
add a list of operators
~QgsSQLComposerDialog() override
void addColumnNames(const QStringList &list, const QString &tableName)
add a list of column names
void setSupportMultipleTables(bool bMultipleTables, const QString &mainTypename=QString())
Sets if multiple tables/joins are supported. Default is false.
void addApis(const QStringList &list)
add a list of API for autocompletion
void setSql(const QString &sql)
initialize the SQL statement
void addFunctions(const QStringList &list)
add a list of functions
void addTableNames(const QStringList &list)
add a list of table names
QPair< QString, QString > PairNameTitle
pair (name, title)
QString sql() const
Gets the SQL statement.
QList< QgsSQLStatement::NodeColumnSorted * > orderBy() const
Returns the list of order by columns.
QList< QgsSQLStatement::NodeSelectedColumn * > columns() const
Returns the list of columns.
bool distinct() const
Returns if the SELECT is DISTINCT.
QList< QgsSQLStatement::NodeJoin * > joins() const
Returns the list of joins.
QgsSQLStatement::Node * where() const
Returns the where clause.
QList< QgsSQLStatement::NodeTableDef * > tables() const
Returns the list of tables.
virtual QString dump() const =0
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.
QgsSubsetStringEditorInterface(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Constructor.
Represents a vector layer which manages a vector based dataset.
description of server functions
QString returnType
Returns type, or empty if unknown.
int maxArgs
maximum number of argument (or -1 if unknown)
int minArgs
minimum number of argument (or -1 if unknown)
QList< Argument > argumentList
list of arguments. May be empty despite minArgs > 0