16#ifndef QGSABSTRACTDATABASEPROVIDERCONNECTION_H
17#define QGSABSTRACTDATABASEPROVIDERCONNECTION_H
66 MaterializedView = 1 << 5,
71 Q_DECLARE_FLAGS( TableFlags, TableFlag )
141 SIP_PYOBJECT __next__();
143 QList<QVariant> result;
144 Py_BEGIN_ALLOW_THREADS
145 result = sipCpp->nextRow( );
147 if ( ! result.isEmpty() )
149 const sipTypeDef *qvariantlist_type = sipFindType(
"QList<QVariant>" );
150 sipRes = sipConvertFromNewType(
new QList<QVariant>( result ), qvariantlist_type, Py_None );
154 PyErr_SetString( PyExc_StopIteration,
"" );
166 struct CORE_EXPORT QueryResultIterator
SIP_SKIP
169 QVariantList nextRow();
172 bool hasNextRow()
const;
175 long long fetchedRowCount();
178 long long rowCount();
180 virtual ~QueryResultIterator() =
default;
184 virtual QVariantList nextRowPrivate() = 0;
185 virtual bool hasNextRowPrivate()
const = 0;
186 virtual long long rowCountPrivate()
const = 0;
188 mutable qlonglong mFetchedRowCount = 0;
189 mutable QMutex mMutex;
198 void appendColumn(
const QString &columnName )
SIP_SKIP;
205 QueryResult( std::shared_ptr<QueryResultIterator> iterator )
SIP_SKIP;
216 double queryExecutionTime( )
const;
221 void setQueryExecutionTime(
double queryExecutionTime );
227 mutable std::shared_ptr<QueryResultIterator> mResultIterator;
228 QStringList mColumns;
230 double mQueryExecutionTime = 0;
253 bool disableSelectAtId =
false;
272 SIP_PYOBJECT __repr__();
274 QString
str = QStringLiteral(
"<QgsAbstractDatabaseProviderConnection.TableProperty: '%1'>" ).arg( sipCpp->tableName() );
275 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
286 SIP_PYOBJECT __repr__();
288 QString
str = QStringLiteral(
"<QgsAbstractDatabaseProviderConnection.TableProperty.GeometryColumnType: '%1, %2'>" ).arg(
QgsWkbTypes::displayString( sipCpp->wkbType ), sipCpp->crs.authid() );
289 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
298 return this->crs == other.
crs && this->wkbType == other.
wkbType;
309 QString tableName()
const;
316 void setTableName(
const QString &name );
328 QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> geometryColumnTypes()
const;
333 void setGeometryColumnTypes(
const QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> &geometryColumnTypes );
342 QString defaultName()
const;
353 QString schema()
const;
358 void setSchema(
const QString &schema );
363 QString geometryColumn()
const;
368 void setGeometryColumn(
const QString &geometryColumn );
373 QStringList primaryKeyColumns()
const;
378 void setPrimaryKeyColumns(
const QStringList &primaryKeyColumns );
383 QList<QgsCoordinateReferenceSystem> crsList()
const;
388 TableFlags flags()
const;
393 void setFlags(
const TableFlags &flags );
398 QString comment()
const;
403 void setComment(
const QString &comment );
411 QVariantMap info()
const;
419 void setInfo(
const QVariantMap &info );
426 int geometryColumnCount()
const;
431 void setGeometryColumnCount(
int geometryColumnCount );
444 int maxCoordinateDimensions()
const;
451 QList<GeometryColumnType> mGeometryColumnTypes;
457 QString mGeometryColumn;
459 int mGeometryColumnCount;
461 QStringList mPkColumns;
484 CreateVectorTable = 1 << 1,
485 DropRasterTable = 1 << 2,
486 DropVectorTable = 1 << 3,
487 RenameVectorTable = 1 << 4,
488 RenameRasterTable = 1 << 5,
489 CreateSchema = 1 << 6,
491 RenameSchema = 1 << 8,
497 TableExists = 1 << 14,
499 CreateSpatialIndex = 1 << 16,
500 SpatialIndexExists = 1 << 17,
501 DeleteSpatialIndex = 1 << 18,
502 DeleteField = 1 << 19,
503 DeleteFieldCascade = 1 << 20,
505 ListFieldDomains = 1 << 22,
506 RetrieveFieldDomain = 1 << 23,
507 SetFieldDomain = 1 << 24,
508 AddFieldDomain = 1 << 25,
509 RenameField = 1 << 26,
510 RetrieveRelationships = 1 << 27,
513 Q_DECLARE_FLAGS( Capabilities, Capability )
514 Q_FLAG( Capabilities )
527 SinglePoint = 1 << 5,
528 SingleLineString = 1 << 6,
529 SinglePolygon = 1 << 7,
533 Q_ENUM( GeometryColumnCapability )
534 Q_DECLARE_FLAGS( GeometryColumnCapabilities, GeometryColumnCapability )
535 Q_FLAG( GeometryColumnCapabilities )
558 Capabilities capabilities()
const;
565 virtual GeometryColumnCapabilities geometryColumnCapabilities();
571 virtual Qgis::SqlLayerDefinitionCapabilities sqlLayerDefinitionCapabilities();
825 QString providerKey() const;
836 virtual QMultiMap<
Qgis::SqlKeywordCategory, QStringList> sqlDictionary();
855 virtual QList<
Qgis::FieldDomainType > supportedFieldDomainTypes() const;
949 void checkCapability(
Capability capability ) const;
952 Capabilities mCapabilities = Capabilities()
SIP_SKIP;
953 GeometryColumnCapabilities mGeometryColumnCapabilities = GeometryColumnCapabilities()
SIP_SKIP;
954 Qgis::SqlLayerDefinitionCapabilities mSqlLayerDefinitionCapabilities =
Qgis::SqlLayerDefinitionCapabilities()
SIP_SKIP;
955 QString mProviderKey;
The Qgis class provides global constants for use throughout the application.
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
GeometryColumnCapability
The GeometryColumnCapability enum represents the geomery column features supported by the connection.
Capability
The Capability enum represents the operations supported by the connection.
TableFlag
Flags for table properties.
The QgsAbstractProviderConnection provides an interface for data provider connections.
This class represents a coordinate reference system (CRS).
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Base class for field domains.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
Custom exception class which is raised when an operation is not supported.
Custom exception class for provider connection related exceptions.
Provides an interface for provider-specific creation of SQL queries.
A rectangle specified with double values.
This is the base class for vector data providers.
Represents a vector layer which manages a vector based data sets.
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields...
Type
The WKB type describes the number of dimensions a geometry has.
static QString displayString(Type type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
#define SIP_THROW(name,...)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
const QgsCoordinateReferenceSystem & crs
The QueryResult class represents the result of a query executed by execSql()
QList< QList< QVariant > > rows(QgsFeedback *feedback=nullptr)
Returns the result rows by calling the iterator internally and fetching all the rows,...
long long fetchedRowCount() const
Returns the number of fetched rows.
bool hasNextRow() const
Returns true if there are more rows to fetch.
QList< QVariant > nextRow() const
Returns the next result row or an empty row if there are no rows left.
long long rowCount() const
Returns the number of rows returned by a SELECT query or Qgis::FeatureCountState::UnknownCount if unk...
QStringList columns() const
Returns the column names.
The SpatialIndexOptions contains extra options relating to spatial index creation.
QString geometryColumnName
Specifies the name of the geometry column to create the index for.
The SqlVectorLayerOptions stores all information required to create a SQL (query) layer.
QString sql
The SQL expression that defines the SQL (query) layer.
QStringList primaryKeyColumns
List of primary key column names.
QString filter
Additional subset string (provider-side filter), not all data providers support this feature: check s...
QString layerName
Optional name for the new layer.
QString geometryColumn
Name of the geometry column.
The GeometryColumnType struct represents the combination of geometry type and CRS for the table geome...
bool operator==(const GeometryColumnType &other) const
QgsWkbTypes::Type wkbType
QgsCoordinateReferenceSystem crs
The TableProperty class represents a database table or view.