22#include "moc_qgssqlcomposerdialog.cpp"
30#include <Qsci/qscilexer.h>
41 connect( mTablesCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mTablesCombo_currentIndexChanged );
42 connect( mColumnsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mColumnsCombo_currentIndexChanged );
43 connect( mSpatialPredicatesCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mSpatialPredicatesCombo_currentIndexChanged );
44 connect( mFunctionsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mFunctionsCombo_currentIndexChanged );
45 connect( mOperatorsCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSQLComposerDialog::mOperatorsCombo_currentIndexChanged );
46 connect( mAddJoinButton, &QPushButton::clicked,
this, &QgsSQLComposerDialog::mAddJoinButton_clicked );
47 connect( mRemoveJoinButton, &QPushButton::clicked,
this, &QgsSQLComposerDialog::mRemoveJoinButton_clicked );
48 connect( mTableJoins, &QTableWidget::itemSelectionChanged,
this, &QgsSQLComposerDialog::mTableJoins_itemSelectionChanged );
50 mQueryEdit->setWrapMode( QsciScintilla::WrapWord );
51 mQueryEdit->installEventFilter(
this );
52 mColumnsEditor->installEventFilter(
this );
53 mTablesEditor->installEventFilter(
this );
54 mTableJoins->installEventFilter(
this );
55 mWhereEditor->installEventFilter(
this );
56 mOrderEditor->installEventFilter(
this );
57 mTablesCombo->view()->installEventFilter(
this );
60 connect( mButtonBox->button( QDialogButtonBox::Reset ), &QAbstractButton::clicked,
61 this, &QgsSQLComposerDialog::reset );
63 connect( mQueryEdit, &QsciScintilla::textChanged,
64 this, &QgsSQLComposerDialog::splitSQLIntoFields );
65 connect( mColumnsEditor, &QTextEdit::textChanged,
66 this, &QgsSQLComposerDialog::buildSQLFromFields );
67 connect( mTablesEditor, &QLineEdit::textChanged,
68 this, &QgsSQLComposerDialog::buildSQLFromFields );
69 connect( mWhereEditor, &QTextEdit::textChanged,
70 this, &QgsSQLComposerDialog::buildSQLFromFields );
71 connect( mOrderEditor, &QTextEdit::textChanged,
72 this, &QgsSQLComposerDialog::buildSQLFromFields );
73 connect( mTableJoins, &QTableWidget::cellChanged,
74 this, &QgsSQLComposerDialog::buildSQLFromFields );
75 connect( mButtonBox, &QDialogButtonBox::helpRequested,
76 this, &QgsSQLComposerDialog::showHelp );
79 baseList << QStringLiteral(
"SELECT" );
80 baseList << QStringLiteral(
"FROM" );
81 baseList << QStringLiteral(
"JOIN" );
82 baseList << QStringLiteral(
"ON" );
83 baseList << QStringLiteral(
"USING" );
84 baseList << QStringLiteral(
"WHERE" );
85 baseList << QStringLiteral(
"AND" );
86 baseList << QStringLiteral(
"OR" );
87 baseList << QStringLiteral(
"NOT" );
88 baseList << QStringLiteral(
"IS" );
89 baseList << QStringLiteral(
"NULL" );
90 baseList << QStringLiteral(
"LIKE" );
91 baseList << QStringLiteral(
"ORDER" );
92 baseList << QStringLiteral(
"BY" );
95 QStringList operatorsList;
96 operatorsList << QStringLiteral(
"AND" );
97 operatorsList << QStringLiteral(
"OR" );
98 operatorsList << QStringLiteral(
"NOT" );
99 operatorsList << QStringLiteral(
"=" );
100 operatorsList << QStringLiteral(
"<" );
101 operatorsList << QStringLiteral(
"<=" );
102 operatorsList << QStringLiteral(
">" );
103 operatorsList << QStringLiteral(
">=" );
104 operatorsList << QStringLiteral(
"<>" );
105 operatorsList << QStringLiteral(
"BETWEEN" );
106 operatorsList << QStringLiteral(
"NOT BETWEEN" );
107 operatorsList << QStringLiteral(
"IS" );
108 operatorsList << QStringLiteral(
"IS NOT" );
109 operatorsList << QStringLiteral(
"IN" );
110 operatorsList << QStringLiteral(
"LIKE" );
113 mAggregatesCombo->hide();
114 mFunctionsCombo->hide();
115 mSpatialPredicatesCombo->hide();
116 mStringFunctionsCombo->hide();
118 delete mPageColumnsValues;
119 mPageColumnsValues =
nullptr;
121 mRemoveJoinButton->setEnabled(
false );
123 mTableJoins->setRowCount( 0 );
124 mTableJoins->setItem( 0, 0,
new QTableWidgetItem( QString() ) );
125 mTableJoins->setItem( 0, 1,
new QTableWidgetItem( QString() ) );
133 delete mQueryEdit->lexer()->apis();
134 mQueryEdit->lexer()->setAPIs(
nullptr );
139 if ( event->type() == QEvent::FocusIn )
141 if ( obj == mTablesCombo->view() )
142 lastSearchedText.clear();
144 mFocusedObject = obj;
148 if ( event->type() == QEvent::KeyPress && obj == mTablesCombo->view() )
150 QString currentString = ( ( QKeyEvent * )event )->text();
151 if ( !currentString.isEmpty() && ( ( currentString[0] >=
'a' && currentString[0] <=
'z' ) ||
152 ( currentString[0] >=
'A' && currentString[0] <=
'Z' ) ||
153 ( currentString[0] >=
'0' && currentString[0] <=
'9' ) ||
154 currentString[0] ==
':' || currentString[0] ==
'_' || currentString[0] ==
' ' ||
155 currentString[0] ==
'(' || currentString[0] ==
')' ) )
159 const int attemptCount = ( lastSearchedText.isEmpty() ) ? 1 : 2;
160 for (
int attempt = 0; attempt < attemptCount; attempt ++ )
163 lastSearchedText += currentString;
165 lastSearchedText = currentString;
170 int iBestCandidate = 0;
171 int idxInTextOfBestCandidate = 1000;
172 for (
int i = 1; i < mTablesCombo->count(); i++ )
174 const int idxInText = mTablesCombo->itemText( i ).indexOf( lastSearchedText, Qt::CaseInsensitive );
175 if ( idxInText >= 0 && idxInText < idxInTextOfBestCandidate )
178 idxInTextOfBestCandidate = idxInText;
181 if ( iBestCandidate > 0 )
183 mTablesCombo->view()->setCurrentIndex( mTablesCombo->model()->index( 0, 0 ).sibling( iBestCandidate, 0 ) );
187 lastSearchedText.clear();
191 return QDialog::eventFilter( obj, event );
196 mTableSelectedCallback = tableSelectedCallback;
201 mSQLValidatorCallback = sqlValidatorCallback;
207 mQueryEdit->setText(
sql );
212 return mQueryEdit->text();
215void QgsSQLComposerDialog::accept()
217 if ( mSQLValidatorCallback )
219 QString errorMsg, warningMsg;
220 if ( !mSQLValidatorCallback->
isValid(
sql(), errorMsg, warningMsg ) )
222 if ( errorMsg.isEmpty() )
223 errorMsg = tr(
"An error occurred during evaluation of the SQL statement." );
224 QMessageBox::critical(
this, tr(
"SQL Evaluation" ), errorMsg );
227 if ( !warningMsg.isEmpty() )
229 QMessageBox::warning(
this, tr(
"SQL Evaluation" ), warningMsg );
239void QgsSQLComposerDialog::buildSQLFromFields()
241 if ( mAlreadyModifyingFields )
243 mAlreadyModifyingFields =
true;
244 QString
sql( QStringLiteral(
"SELECT " ) );
246 sql += QLatin1String(
"DISTINCT " );
247 sql += mColumnsEditor->toPlainText();
248 sql += QLatin1String(
" FROM " );
249 sql += mTablesEditor->text();
251 const int rows = mTableJoins->rowCount();
252 for (
int i = 0; i < rows; i++ )
254 QTableWidgetItem *itemTable = mTableJoins->item( i, 0 );
255 QTableWidgetItem *itemOn = mTableJoins->item( i, 1 );
256 if ( itemTable && !itemTable->text().isEmpty() &&
257 itemOn && !itemOn->text().isEmpty() )
259 sql += QLatin1String(
" JOIN " );
260 sql += itemTable->text();
261 sql += QLatin1String(
" ON " );
262 sql += itemOn->text();
266 if ( !mWhereEditor->toPlainText().isEmpty() )
268 sql += QLatin1String(
" WHERE " );
269 sql += mWhereEditor->toPlainText();
271 if ( !mOrderEditor->toPlainText().isEmpty() )
273 sql += QLatin1String(
" ORDER BY " );
274 sql += mOrderEditor->toPlainText();
276 mQueryEdit->setText(
sql );
278 mAlreadyModifyingFields =
false;
281void QgsSQLComposerDialog::splitSQLIntoFields()
283 if ( mAlreadyModifyingFields )
286 if (
sql.hasParserError() )
292 const QList<QgsSQLStatement::NodeSelectedColumn *> columns = nodeSelect->
columns();
294 const auto constColumns = columns;
297 if ( !columnText.isEmpty() )
298 columnText += QLatin1String(
", " );
299 columnText += column->dump();
302 const QList<QgsSQLStatement::NodeTableDef *> tables = nodeSelect->
tables();
304 const auto constTables = tables;
307 if ( !tablesText.isEmpty() )
308 tablesText += QLatin1String(
", " );
310 tablesText += table->dump();
316 whereText = where->
dump();
319 const QList<QgsSQLStatement::NodeColumnSorted *> orderColumns = nodeSelect->
orderBy();
320 const auto constOrderColumns = orderColumns;
323 if ( !orderText.isEmpty() )
324 orderText += QLatin1String(
", " );
325 orderText += column->dump();
328 const QList<QgsSQLStatement::NodeJoin *> joins = nodeSelect->
joins();
330 mAlreadyModifyingFields =
true;
331 mColumnsEditor->setPlainText( columnText );
332 mTablesEditor->setText( tablesText );
333 mWhereEditor->setPlainText( whereText );
334 mOrderEditor->setPlainText( orderText );
336 mTableJoins->setRowCount( joins.size() + 1 );
338 const auto constJoins = joins;
342 mTableJoins->setItem( iRow, 0,
new QTableWidgetItem( join->tableDef()->dump() ) );
343 if ( join->onExpr() )
344 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( join->onExpr()->dump() ) );
346 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( QString() ) );
349 mTableJoins->setItem( iRow, 0,
new QTableWidgetItem( QString() ) );
350 mTableJoins->setItem( iRow, 1,
new QTableWidgetItem( QString() ) );
352 mAlreadyModifyingFields =
false;
357 const auto constList = list;
358 for (
const QString &name : constList )
359 mapTableEntryTextToName[name] = name;
360 mTablesCombo->addItems( list );
366 QStringList listCombo;
368 const auto constListNameTitle = listNameTitle;
371 listApi << pair.first;
372 QString entryText( pair.first );
373 if ( !pair.second.isEmpty() && pair.second != pair.first )
375 if ( pair.second.size() < 40 )
376 entryText +=
" (" + pair.second +
")";
378 entryText +=
" (" + pair.second.mid( 0, 20 ) + QChar( 0x2026 ) + pair.second.mid( pair.second.size() - 20 ) +
")";
380 listCombo << entryText;
381 mapTableEntryTextToName[entryText] = pair.first;
383 mTablesCombo->addItems( listCombo );
389 QList<PairNameType> listPair;
390 const auto constList = list;
391 for (
const QString &name : constList )
396static QString sanitizeType( QString type )
398 if ( type.startsWith( QLatin1String(
"xs:" ) ) )
399 return type.mid( 3 );
400 if ( type.startsWith( QLatin1String(
"xsd:" ) ) )
401 return type.mid( 4 );
402 if ( type == QLatin1String(
"gml:AbstractGeometryType" ) )
403 return QStringLiteral(
"geometry" );
409 mAlreadySelectedTables.insert( tableName );
410 if ( mColumnsCombo->count() > 1 )
411 mColumnsCombo->insertSeparator( mColumnsCombo->count() );
413 QStringList listCombo;
415 const auto constList = list;
418 listApi << pair.first;
419 QString entryText( pair.first );
420 if ( !pair.second.isEmpty() )
422 entryText +=
" (" + sanitizeType( pair.second ) +
")";
424 listCombo << entryText;
425 mapColumnEntryTextToName[entryText] = pair.first;
427 mColumnsCombo->addItems( listCombo );
434 mOperatorsCombo->addItems( list );
442 return QObject::tr(
"%1 to %n argument(s)",
nullptr, f.
maxArgs ).arg( f.
minArgs );
449 return QObject::tr(
"%n argument(s)",
nullptr, f.
minArgs );
453 return QObject::tr(
"%n argument(s) or more",
nullptr, f.
minArgs );
459void QgsSQLComposerDialog::getFunctionList(
const QList<Function> &list,
460 QStringList &listApi,
461 QStringList &listCombo,
462 QMap<QString, QString> &mapEntryTextToName )
464 const auto constList = list;
465 for (
const Function &f : constList )
468 QString entryText( f.
name );
469 entryText += QLatin1Char(
'(' );
474 if ( f.
minArgs >= 0 && i >= f.
minArgs ) entryText += QLatin1Char(
'[' );
475 if ( i > 0 ) entryText += QLatin1String(
", " );
483 const QString sanitizedType( sanitizeType( f.
argumentList[i].type ) );
487 entryText += QLatin1String(
": " );
488 entryText += sanitizedType;
491 if ( f.
minArgs >= 0 && i >= f.
minArgs ) entryText += QLatin1Char(
']' );
493 if ( entryText.size() > 60 )
496 entryText += QLatin1Char(
'(' );
497 entryText += getFunctionAbbridgedParameters( f );
502 entryText += getFunctionAbbridgedParameters( f );
504 entryText += QLatin1Char(
')' );
506 entryText +=
": " + sanitizeType( f.
returnType );
507 listCombo << entryText;
508 mapEntryTextToName[entryText] = f.
name +
"(";
514 QList<Function> listFunction;
515 const auto constList = list;
516 for (
const QString &name : constList )
528 QStringList listCombo;
529 getFunctionList( list, listApi, listCombo, mapSpatialPredicateEntryTextToName );
530 mSpatialPredicatesCombo->addItems( listCombo );
531 mSpatialPredicatesCombo->show();
537 QList<Function> listFunction;
538 const auto constList = list;
539 for (
const QString &name : constList )
551 QStringList listCombo;
552 getFunctionList( list, listApi, listCombo, mapFunctionEntryTextToName );
553 mFunctionsCombo->addItems( listCombo );
554 mFunctionsCombo->show();
558void QgsSQLComposerDialog::loadTableColumns(
const QString &table )
560 if ( mTableSelectedCallback )
562 if ( !mAlreadySelectedTables.contains( table ) )
565 mAlreadySelectedTables.insert( table );
570static void resetCombo( QComboBox *combo )
577 QMetaObject::invokeMethod( combo,
"setCurrentIndex", Qt::QueuedConnection, Q_ARG(
int, 0 ) );
580void QgsSQLComposerDialog::mTablesCombo_currentIndexChanged(
int )
582 const int index = mTablesCombo->currentIndex();
585 QObject *obj = mFocusedObject;
586 const QString newText = mapTableEntryTextToName[mTablesCombo->currentText()];
587 loadTableColumns( newText );
588 if ( obj == mTablesEditor )
590 const QString currentText = mTablesEditor->text();
591 if ( currentText.isEmpty() )
592 mTablesEditor->setText( newText );
594 mTablesEditor->setText( currentText +
", " + newText );
596 else if ( obj == mTableJoins )
598 if ( mTableJoins->selectedItems().size() == 1 )
600 mTableJoins->selectedItems().at( 0 )->setText( newText );
603 else if ( obj == mWhereEditor )
605 mWhereEditor->insertPlainText( newText );
607 else if ( obj == mOrderEditor )
609 mOrderEditor->insertPlainText( newText );
611 else if ( obj == mQueryEdit )
613 mQueryEdit->insertText( newText );
615 resetCombo( mTablesCombo );
618void QgsSQLComposerDialog::mColumnsCombo_currentIndexChanged(
int )
620 const int index = mColumnsCombo->currentIndex();
623 QObject *obj = mFocusedObject;
624 const QString newText = mapColumnEntryTextToName[mColumnsCombo->currentText()];
625 if ( obj == mColumnsEditor )
627 const QString currentText = mColumnsEditor->toPlainText();
628 if ( currentText.isEmpty() )
629 mColumnsEditor->insertPlainText( newText );
631 mColumnsEditor->insertPlainText(
",\n" + newText );
633 else if ( obj == mTableJoins )
635 if ( mTableJoins->selectedItems().size() == 1 &&
636 mTableJoins->selectedItems().at( 0 )->column() == 1 )
638 const QString currentText( mTableJoins->selectedItems().at( 0 )->text() );
639 if ( !currentText.isEmpty() && !currentText.contains( QLatin1String(
"=" ) ) )
640 mTableJoins->selectedItems().at( 0 )->setText( currentText +
" = " + newText );
642 mTableJoins->selectedItems().at( 0 )->setText( currentText + newText );
645 else if ( obj == mWhereEditor )
647 mWhereEditor->insertPlainText( newText );
649 else if ( obj == mOrderEditor )
651 mOrderEditor->insertPlainText( newText );
653 else if ( obj == mQueryEdit )
655 mQueryEdit->insertText( newText );
657 resetCombo( mColumnsCombo );
660void QgsSQLComposerDialog::mFunctionsCombo_currentIndexChanged(
int )
662 functionCurrentIndexChanged( mFunctionsCombo, mapFunctionEntryTextToName );
665void QgsSQLComposerDialog::mSpatialPredicatesCombo_currentIndexChanged(
int )
667 functionCurrentIndexChanged( mSpatialPredicatesCombo, mapSpatialPredicateEntryTextToName );
670void QgsSQLComposerDialog::functionCurrentIndexChanged( QComboBox *combo,
671 const QMap<QString, QString> &mapEntryTextToName )
673 const int index = combo->currentIndex();
676 QObject *obj = mFocusedObject;
677 const QString newText = mapEntryTextToName[combo->currentText()];
678 if ( obj == mColumnsEditor )
680 mColumnsEditor->insertPlainText( newText );
682 else if ( obj == mWhereEditor )
684 mWhereEditor->insertPlainText( newText );
686 else if ( obj == mQueryEdit )
688 mQueryEdit->insertText( newText );
693void QgsSQLComposerDialog::mOperatorsCombo_currentIndexChanged(
int )
695 const int index = mOperatorsCombo->currentIndex();
698 QObject *obj = mFocusedObject;
699 const QString newText = mOperatorsCombo->currentText();
700 if ( obj == mColumnsEditor )
702 mColumnsEditor->insertPlainText( newText );
704 else if ( obj == mWhereEditor )
706 mWhereEditor->insertPlainText( newText );
708 else if ( obj == mTableJoins )
710 if ( mTableJoins->selectedItems().size() == 1 &&
711 mTableJoins->selectedItems().at( 0 )->column() == 1 )
713 const QString currentText( mTableJoins->selectedItems().at( 0 )->text() );
714 mTableJoins->selectedItems().at( 0 )->setText( currentText + newText );
717 else if ( obj == mQueryEdit )
719 mQueryEdit->insertText( newText );
721 resetCombo( mOperatorsCombo );
724void QgsSQLComposerDialog::mAddJoinButton_clicked()
726 int insertRow = mTableJoins->currentRow();
727 const int rowCount = mTableJoins->rowCount();
729 insertRow = rowCount;
730 mTableJoins->setRowCount( rowCount + 1 );
731 for (
int row = rowCount ; row > insertRow + 1; row -- )
733 mTableJoins->setItem( row, 0, mTableJoins->takeItem( row - 1, 0 ) );
734 mTableJoins->setItem( row, 1, mTableJoins->takeItem( row - 1, 1 ) );
736 mTableJoins->setItem( ( insertRow == rowCount ) ? insertRow : insertRow + 1, 0, new QTableWidgetItem( QString() ) );
737 mTableJoins->setItem( ( insertRow == rowCount ) ? insertRow : insertRow + 1, 1, new QTableWidgetItem( QString() ) );
740void QgsSQLComposerDialog::mRemoveJoinButton_clicked()
742 int row = mTableJoins->currentRow();
745 const int rowCount = mTableJoins->rowCount();
746 for ( ; row < rowCount - 1; row ++ )
748 mTableJoins->setItem( row, 0, mTableJoins->takeItem( row + 1, 0 ) );
749 mTableJoins->setItem( row, 1, mTableJoins->takeItem( row + 1, 1 ) );
751 mTableJoins->setRowCount( rowCount - 1 );
753 buildSQLFromFields();
756void QgsSQLComposerDialog::reset()
758 mQueryEdit->setText( mResetSql );
761void QgsSQLComposerDialog::mTableJoins_itemSelectionChanged()
763 mRemoveJoinButton->setEnabled( mTableJoins->selectedItems().size() == 1 );
770 delete mQueryEdit->lexer()->apis();
771 QsciAPIs *apis =
new QsciAPIs( mQueryEdit->lexer() );
773 const auto constMApiList = mApiList;
774 for (
const QString &
str : constMApiList )
780 mQueryEdit->lexer()->setAPIs( apis );
785 mJoinsLabels->setVisible( on );
786 mTableJoins->setVisible( on );
787 mAddJoinButton->setVisible( on );
788 mRemoveJoinButton->setVisible( on );
789 mTablesCombo->setVisible( on );
791 QString mainTypenameFormatted;
792 if ( !mainTypename.isEmpty() )
793 mainTypenameFormatted =
"(" + mainTypename +
")";
794 mQueryEdit->setToolTip( tr(
"This is the SQL query editor. The SQL statement can select data from several tables, \n"
795 "but it must compulsory include the main typename %1 in the selected tables, \n"
796 "and only the geometry column of the main typename can be used as the geometry column of the resulting layer." ).arg( mainTypenameFormatted ) );
799void QgsSQLComposerDialog::showHelp()
801 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.
Class for parsing SQL statements.
static QString quotedIdentifierIfNeeded(const QString &name)
Returns a quoted column reference (in double quotes) if needed, or otherwise the original string.
Interface for a dialog that can edit subset strings.
Represents a vector layer which manages a vector based data sets.
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
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