Skip to content
Permalink
Browse files
Provider QSCI APIs for sqlite and PG
  • Loading branch information
elpaso committed Jul 6, 2021
1 parent af9febc commit 27eb5743ad4dd9b0a9bb9226b3c1fe98e33ccc17
@@ -11,3 +11,4 @@
QgsAbstractDatabaseProviderConnection.SqlLayerDefinitionCapability.baseClass = QgsAbstractDatabaseProviderConnection
QgsAbstractDatabaseProviderConnection.SqlLayerDefinitionCapabilities.baseClass = QgsAbstractDatabaseProviderConnection
SqlLayerDefinitionCapabilities = QgsAbstractDatabaseProviderConnection # dirty hack since SIP seems to introduce the flags in module
QgsAbstractDatabaseProviderConnection.SqlKeywordCategory.baseClass = QgsAbstractDatabaseProviderConnection
@@ -355,6 +355,20 @@ This information is calculated from the geometry columns types.
typedef QFlags<QgsAbstractDatabaseProviderConnection::SqlLayerDefinitionCapability> SqlLayerDefinitionCapabilities;


enum SqlKeywordCategory
{
Keyword,
Constant,
Function,
Geospatial,
Operator,
Math,
Aggregate,
String,
Identifier
};


QgsAbstractDatabaseProviderConnection( const QString &name );
%Docstring
Creates a new connection with ``name`` by reading its configuration from the settings.
@@ -659,6 +673,17 @@ Returns a list of native types supported by the connection.
Returns the provider key.

.. versionadded:: 3.16
%End

virtual QMap<QgsAbstractDatabaseProviderConnection::SqlKeywordCategory, QStringList> sqlDictionary();
%Docstring
Returns a dictionary of SQL keywords supported by the provider.
The default implementation returns an list of common reserved words under the
"Keyword" and "Constant" categories.

Subclasses should add provider- and/or connection- specific words.

.. versionadded:: 3.20
%End

protected:
@@ -51,6 +51,28 @@ Set field names to ``fieldNames`` to be added to the lexer API.
QStringList fieldNames() const;
%Docstring
Return field names from the lexer API.
%End

void setExtraKeywords( const QStringList &extraKeywords );
%Docstring
Set extra keywords to ``extraKeywords``.

Extra keywords are usually added
from provider connections and represent function and other provider specific
keywords.

.. versionadded:: 3.20
%End

QStringList extraKeywords() const;
%Docstring
Returns the extra keywords.

Extra keywords are usually added
from provider connections and represent function and other provider specific
keywords.

.. versionadded:: 3.20
%End

protected:
@@ -97,6 +97,7 @@ Emitted when the first batch of results has been fetched.
If the query returns no results this signal is not emitted.
%End


};

/************************************************************************

Large diffs are not rendered by default.

@@ -82,6 +82,7 @@ class QgsGeoPackageProviderConnection : public QgsAbstractDatabaseProviderConnec
QIcon icon() const override;
QList<QgsVectorDataProvider::NativeType> nativeTypes() const override;
QgsFields fields( const QString &schema, const QString &table ) const override;
QMap<QgsAbstractDatabaseProviderConnection::SqlKeywordCategory, QStringList> sqlDictionary() override;

private:

@@ -91,7 +92,6 @@ class QgsGeoPackageProviderConnection : public QgsAbstractDatabaseProviderConnec
//! Returns PK name for table
QString primaryKeyColumnName( const QString &table ) const;


};


0 comments on commit 27eb574

Please sign in to comment.