16 #ifndef QGSABSTRACTDATABASEPROVIDERCONNECTION_H
17 #define QGSABSTRACTDATABASEPROVIDERCONNECTION_H
21 #include "qgis_core.h"
63 MaterializedView = 1 << 5,
68 Q_DECLARE_FLAGS( TableFlags, TableFlag )
89 QStringList columns()
const;
98 QList<QList<QVariant> > rows(
QgsFeedback *feedback =
nullptr );
106 bool hasNextRow()
const;
114 QList<QVariant> nextRow()
const;
121 long long fetchedRowCount( )
const;
128 long long rowCount( )
const;
138 SIP_PYOBJECT __next__();
140 QList<QVariant> result;
141 Py_BEGIN_ALLOW_THREADS
142 result = sipCpp->nextRow( );
144 if ( ! result.isEmpty() )
146 const sipTypeDef *qvariantlist_type = sipFindType(
"QList<QVariant>" );
147 sipRes = sipConvertFromNewType(
new QList<QVariant>( result ), qvariantlist_type, Py_None );
151 PyErr_SetString( PyExc_StopIteration,
"" );
163 struct CORE_EXPORT QueryResultIterator
SIP_SKIP
166 QVariantList nextRow();
169 bool hasNextRow()
const;
172 long long fetchedRowCount();
175 long long rowCount();
177 virtual ~QueryResultIterator() =
default;
181 virtual QVariantList nextRowPrivate() = 0;
182 virtual bool hasNextRowPrivate()
const = 0;
183 virtual long long rowCountPrivate()
const = 0;
185 mutable qlonglong mFetchedRowCount = 0;
186 mutable QMutex mMutex;
195 void appendColumn(
const QString &columnName )
SIP_SKIP;
213 double queryExecutionTime( )
const;
218 void setQueryExecutionTime(
double queryExecutionTime );
224 mutable std::shared_ptr<QueryResultIterator> mResultIterator;
225 QStringList mColumns;
227 double mQueryExecutionTime = 0;
250 bool disableSelectAtId =
false;
269 SIP_PYOBJECT __repr__();
271 QString
str = QStringLiteral(
"<QgsAbstractDatabaseProviderConnection.TableProperty: '%1'>" ).arg( sipCpp->tableName() );
272 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
283 SIP_PYOBJECT __repr__();
285 QString
str = QStringLiteral(
"<QgsAbstractDatabaseProviderConnection.TableProperty.GeometryColumnType: '%1, %2'>" ).arg(
QgsWkbTypes::displayString( sipCpp->wkbType ), sipCpp->crs.authid() );
286 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
295 return this->crs == other.
crs && this->wkbType == other.
wkbType;
306 QString tableName()
const;
313 void setTableName(
const QString &name );
325 QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> geometryColumnTypes()
const;
330 void setGeometryColumnTypes(
const QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> &geometryColumnTypes );
339 QString defaultName()
const;
350 QString schema()
const;
355 void setSchema(
const QString &schema );
360 QString geometryColumn()
const;
365 void setGeometryColumn(
const QString &geometryColumn );
370 QStringList primaryKeyColumns()
const;
375 void setPrimaryKeyColumns(
const QStringList &primaryKeyColumns );
380 QList<QgsCoordinateReferenceSystem> crsList()
const;
385 TableFlags flags()
const;
390 void setFlags(
const TableFlags &flags );
395 QString comment()
const;
400 void setComment(
const QString &comment );
408 QVariantMap info()
const;
416 void setInfo(
const QVariantMap &info );
423 int geometryColumnCount()
const;
428 void setGeometryColumnCount(
int geometryColumnCount );
441 int maxCoordinateDimensions()
const;
448 QList<GeometryColumnType> mGeometryColumnTypes;
454 QString mGeometryColumn;
456 int mGeometryColumnCount;
458 QStringList mPkColumns;
481 CreateVectorTable = 1 << 1,
482 DropRasterTable = 1 << 2,
483 DropVectorTable = 1 << 3,
484 RenameVectorTable = 1 << 4,
485 RenameRasterTable = 1 << 5,
486 CreateSchema = 1 << 6,
488 RenameSchema = 1 << 8,
494 TableExists = 1 << 14,
496 CreateSpatialIndex = 1 << 16,
497 SpatialIndexExists = 1 << 17,
498 DeleteSpatialIndex = 1 << 18,
499 DeleteField = 1 << 19,
500 DeleteFieldCascade = 1 << 20,
502 ListFieldDomains = 1 << 22,
503 RetrieveFieldDomain = 1 << 23,
504 SetFieldDomain = 1 << 24,
505 AddFieldDomain = 1 << 25,
508 Q_DECLARE_FLAGS( Capabilities, Capability )
509 Q_FLAG( Capabilities )
524 Q_ENUM( GeometryColumnCapability )
525 Q_DECLARE_FLAGS( GeometryColumnCapabilities, GeometryColumnCapability )
526 Q_FLAG( GeometryColumnCapabilities )
549 Capabilities capabilities()
const;
556 virtual GeometryColumnCapabilities geometryColumnCapabilities();
562 virtual Qgis::SqlLayerDefinitionCapabilities sqlLayerDefinitionCapabilities();
801 QString providerKey() const;
812 virtual QMultiMap<
Qgis::SqlKeywordCategory, QStringList> sqlDictionary();
873 void checkCapability( Capability capability ) const;
876 Capabilities mCapabilities = Capabilities()
SIP_SKIP;
877 GeometryColumnCapabilities mGeometryColumnCapabilities = GeometryColumnCapabilities()
SIP_SKIP;
878 Qgis::SqlLayerDefinitionCapabilities mSqlLayerDefinitionCapabilities =
Qgis::SqlLayerDefinitionCapabilities()
SIP_SKIP;
879 QString mProviderKey;
885 #endif // QGSABSTRACTDATABASEPROVIDERCONNECTION_H