29#include "moc_qgsabstractdatabaseproviderconnection.cpp"
31using namespace Qt::StringLiterals;
83 static QMetaEnum metaEnum = QMetaEnum::fromType<QgsAbstractDatabaseProviderConnection::Capability>();
84 const QString capName { metaEnum.valueToKey( capability ) };
85 throw QgsProviderConnectionException( QObject::tr(
"Operation '%1' is not supported for this connection" ).arg( capName ) );
93 throw QgsProviderConnectionException( QObject::tr(
"Operation '%1' is not supported for this connection" ).arg(
qgsEnumValueToKey( capability ) ) );
97QString QgsAbstractDatabaseProviderConnection::sanitizeSqlForQueryLayer(
const QString &sql )
const
99 QString sanitizedSql { sql.trimmed() };
100 while ( sanitizedSql.endsWith(
';' ) )
102 sanitizedSql.chop( 1 );
163 u
"ARRAY_MAX_CARDINALITY"_s,
189 u
"BEGIN_PARTITION"_s,
227 u
"CHARACTER_LENGTH"_s,
267 u
"CONVERT_TABLE_HEADER"_s,
284 u
"CURRENT_CATALOG"_s,
286 u
"CURRENT_DEFAULT_TRANSFORM_GROUP"_s,
287 u
"CURRENT_LC_CTYPE"_s,
294 u
"CURRENT_TIMESTAMP"_s,
295 u
"CURRENT_TIMEZONE"_s,
296 u
"CURRENT_TRANSFORM_GROUP_FOR_TYPE"_s,
310 u
"DAY_MICROSECOND"_s,
457 u
"HOUR_MICROSECOND"_s,
464 u
"IDENTITY_INSERT"_s,
501 u
"IO_BEFORE_GTIDS"_s,
517 u
"JSON_TABLE_PRIMITIVE"_s,
574 u
"MASTER_SSL_VERIFY_SERVER_CERT"_s,
578 u
"MATCH_RECOGNIZE"_s,
601 u
"MINUTE_MICROSECOND"_s,
627 u
"NESTED_TABLE_ID"_s,
642 u
"NO_WRITE_TO_BINLOG"_s,
655 u
"OCCURRENCES_REGEX"_s,
677 u
"OPTIMIZER_COSTS"_s,
708 u
"PERCENTILE_CONT"_s,
709 u
"PERCENTILE_DISC"_s,
794 u
"RESULT_SET_LOCATOR"_s,
814 u
"ROUND_HALF_DOWN"_s,
815 u
"ROUND_HALF_EVEN"_s,
841 u
"SECOND_MICROSECOND"_s,
850 u
"SEMANTICKEYPHRASETABLE"_s,
851 u
"SEMANTICSIMILARITYDETAILSTABLE"_s,
852 u
"SEMANTICSIMILARITYTABLE"_s,
885 u
"SQL_CALC_FOUND_ROWS"_s,
887 u
"SQL_SMALL_RESULT"_s,
918 u
"SUBSTRING_REGEX"_s,
947 u
"TIMEZONE_MINUTE"_s,
960 u
"TRANSLATE_REGEX"_s,
1098 const QString &name,
1103 const QMap<QString, QVariant> *
1110 Q_UNUSED( overwrite );
1111 Q_UNUSED( options );
1112 Q_UNUSED( wkbType );
1141 const QList<QgsAbstractDatabaseProviderConnection::TableProperty> constTables {
tables( schema ) };
1142 for (
const auto &t : constTables )
1144 if ( t.tableName() == name )
1155 Q_UNUSED( feedback );
1156 Q_UNUSED( searchContext );
1157 Q_UNUSED( searchString );
1158 Q_UNUSED( geographicExtent );
1234 std::unique_ptr<QgsVectorLayer> vl { std::make_unique<QgsVectorLayer>(
tableUri( schema, tableName ), u
"temp_layer"_s,
mProviderKey, options ) };
1235 if ( ! vl->isValid() )
1238 .arg( tableName, schema ) );
1240 if ( vl->fields().lookupField( fieldName ) == -1 )
1243 .arg( fieldName, tableName, schema ) );
1246 if ( ! vl->dataProvider()->deleteAttributes( { vl->fields().lookupField( fieldName ) } ) )
1249 .arg( fieldName, tableName, schema ) );
1259 auto vl = std::make_unique<QgsVectorLayer>(
tableUri( schema, tableName ), u
"temp_layer"_s,
mProviderKey, options ) ;
1260 if ( ! vl->isValid() )
1263 .arg( tableName, schema ) );
1265 if ( vl->fields().lookupField( field.
name() ) != -1 )
1268 .arg( field.
name(), tableName, schema ) );
1271 if ( ! vl->dataProvider()->addAttributes( { field } ) )
1274 .arg( field.
name(), tableName, schema ) );
1284 auto vl = std::make_unique<QgsVectorLayer>(
tableUri( schema, tableName ), u
"temp_layer"_s,
mProviderKey, options ) ;
1285 if ( ! vl->isValid() )
1288 .arg( tableName, schema ) );
1290 int existingIndex = vl->fields().lookupField( name );
1291 if ( existingIndex == -1 )
1294 .arg( name, tableName ) );
1297 if ( vl->fields().lookupField( newName ) != -1 )
1300 .arg( newName, tableName ) );
1303 if ( ! vl->dataProvider()->renameAttributes( {{existingIndex, newName}} ) )
1306 .arg( name, tableName, newName ) );
1313 return QList<QgsAbstractDatabaseProviderConnection::TableProperty>();
1320 const QList<QgsAbstractDatabaseProviderConnection::TableProperty> constTables {
tables( schema,
TableFlags(), feedback ) };
1321 for (
const auto &t : constTables )
1323 if ( t.tableName() == name )
1329 .arg( name, schema ) );
1341 return QStringList();
1358 for (
const auto &t : std::as_const( mGeometryColumnTypes ) )
1365 mGeometryColumnTypes.push_back( toAdd );
1370 return mGeometryColumnTypes;
1393 return QStringList();
1460 QString n = mTableName;
1461 if ( mGeometryColumnCount > 1 ) n +=
'.' + mGeometryColumn;
1468 Q_UNUSED( tableName );
1469 Q_UNUSED( targetSchema );
1477 Q_ASSERT( index >= 0 && index < mGeometryColumnTypes.size() );
1479 property.mGeometryColumnTypes << mGeometryColumnTypes[ index ];
1480 property.mSchema = mSchema;
1481 property.mTableName = mTableName;
1482 property.mGeometryColumn = mGeometryColumn;
1483 property.mPkColumns = mPkColumns;
1484 property.mGeometryColumnCount = mGeometryColumnCount;
1485 property.mFlags = mFlags;
1486 property.mComment = mComment;
1487 property.mInfo = mInfo;
1508 return mSchema == other.mSchema &&
1509 mTableName == other.mTableName &&
1510 mGeometryColumn == other.mGeometryColumn &&
1511 mGeometryColumnCount == other.mGeometryColumnCount &&
1512 mPkColumns == other.mPkColumns &&
1513 mFlags == other.mFlags &&
1514 mComment == other.mComment &&
1515 mInfo == other.mInfo;
1521 mGeometryColumnTypes = columnTypes;
1527 return mGeometryColumnCount;
1567 QList<QgsCoordinateReferenceSystem> crss;
1568 for (
const auto &t : std::as_const( mGeometryColumnTypes ) )
1570 crss.push_back( t.crs );
1582 mPkColumns = pkColumns;
1587 return mGeometryColumn;
1615 QList<QList<QVariant> > rows;
1617 while ( mResultIterator &&
1618 mResultIterator->hasNextRow() &&
1621 const QVariantList row( mResultIterator->nextRow() );
1622 if ( row.isEmpty() )
1628 rows.push_back( row );
1636 if ( ! mResultIterator )
1638 return QList<QVariant>();
1640 return mResultIterator->nextRow();
1646 if ( ! mResultIterator )
1650 return mResultIterator->fetchedRowCount();
1655 if ( ! mResultIterator )
1659 return mResultIterator->rowCount();
1664 const QgsSQLStatement statement { sql };
1670 const QgsSQLStatement::NodeSelect *nodeSelect =
dynamic_cast<const QgsSQLStatement::NodeSelect *
>( statement.
rootNode() );
1672 if ( !nodeSelect || !nodeSelect->
joins().empty() || !nodeSelect->
orderBy().empty() )
1677 const QList<QgsSQLStatement::NodeTableDef *> tablesList { nodeSelect->
tables() };
1679 if ( tablesList.empty() )
1684 for (
const QgsSQLStatement::NodeTableDef *tableDef : tablesList )
1686 tables.append( tableDef->name() );
1689 const QList<QgsSQLStatement::NodeSelectedColumn *> columnsList { nodeSelect->
columns() };
1691 if ( columnsList.empty() )
1696 for (
const QgsSQLStatement::NodeSelectedColumn *colDef : columnsList )
1698 columns.append( colDef->dump() );
1701 if ( nodeSelect->
where() )
1712 if ( ! mResultIterator )
1716 return mResultIterator->hasNextRow();
1719void QgsAbstractDatabaseProviderConnection::QueryResult::appendColumn(
const QString &columnName )
1721 mColumns.push_back( columnName );
1724QgsAbstractDatabaseProviderConnection::QueryResult::QueryResult( std::shared_ptr<QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator> iterator )
1725 : mResultIterator( std::move( iterator ) )
1728double QgsAbstractDatabaseProviderConnection::QueryResult::queryExecutionTime()
const
1730 return mQueryExecutionTime;
1733void QgsAbstractDatabaseProviderConnection::QueryResult::setQueryExecutionTime(
double queryExecutionTime )
1735 mQueryExecutionTime = queryExecutionTime;
1739QVariantList QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::nextRow()
1741 QMutexLocker lock( &mMutex );
1742 const QVariantList row = nextRowPrivate();
1743 if ( ! row.isEmpty() )
1750bool QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::hasNextRow()
const
1752 QMutexLocker lock( &mMutex );
1753 return hasNextRowPrivate();
1756long long QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::fetchedRowCount()
1758 QMutexLocker lock( &mMutex );
1759 return mFetchedRowCount;
1762long long QgsAbstractDatabaseProviderConnection::QueryResult::QueryResultIterator::rowCount()
1764 QMutexLocker lock( &mMutex );
1765 return rowCountPrivate();
DatabaseProviderConnectionCapability2
The Capability enum represents the extended operations supported by the connection.
@ SetTableComment
Can set comments for tables via setTableComment().
@ DeleteFieldDomain
Can delete existing field domain.
@ SetFieldComment
Can set comments for fields via setFieldComment().
@ EditFieldDomain
Can edit existing field domain.
@ SetFieldAlias
Can set aliases for fields via setFieldAlias().
QFlags< RelationshipCapability > RelationshipCapabilities
Relationship capabilities.
QFlags< DatabaseProviderConnectionCapability2 > DatabaseProviderConnectionCapabilities2
WkbType
The WKB type describes the number of dimensions a geometry has.
QFlags< SqlLayerDefinitionCapability > SqlLayerDefinitionCapabilities
SQL layer definition capabilities.
virtual QString defaultGeometryColumnName() const
Returns the default name to use for a geometry column for the connection.
virtual void setFieldComment(const QString &fieldName, const QString &schema, const QString &tableName, const QString &comment) const
Sets the comment for the existing field with the specified name.
virtual QList< QgsWeakRelation > relationships(const QString &schema=QString(), const QString &tableName=QString()) const
Returns a list of relationships detected in the database.
virtual void createVectorTable(const QString &schema, const QString &name, const QgsFields &fields, Qgis::WkbType wkbType, const QgsCoordinateReferenceSystem &srs, bool overwrite, const QMap< QString, QVariant > *options) const
Creates an empty table with name in the given schema (schema is ignored if not supported by the backe...
virtual QgsVectorLayer * createSqlVectorLayer(const SqlVectorLayerOptions &options) const
Creates and returns a (possibly invalid) vector layer based on a SQL statement and options.
virtual bool tableExists(const QString &schema, const QString &name) const
Checks whether a table name exists in the given schema.
TableFlag
Flags for table properties.
QList< QgsAbstractDatabaseProviderConnection::TableProperty > tablesInt(const QString &schema=QString(), const int flags=0) const
Returns information on the tables in the given schema.
virtual void updateRelationship(const QgsWeakRelation &relationship) const
Updates an existing relationship in the database.
virtual void renameField(const QString &schema, const QString &tableName, const QString &name, const QString &newName) const
Renames an existing field.
virtual void deleteFieldDomain(const QString &name, const QString &schema) const
Deletes the field domain with the specified name from the provider.
virtual void dropSchema(const QString &name, bool force=false) const
Drops an entire schema with the specified name.
Qgis::SqlLayerDefinitionCapabilities mSqlLayerDefinitionCapabilities
virtual void addField(const QgsField &field, const QString &schema, const QString &tableName) const
Adds a field.
virtual QList< QgsAbstractDatabaseProviderConnection::TableProperty > tables(const QString &schema=QString(), const QgsAbstractDatabaseProviderConnection::TableFlags &flags=QgsAbstractDatabaseProviderConnection::TableFlags(), QgsFeedback *feedback=nullptr) const
Returns information on the tables in the given schema.
Qgis::DatabaseProviderConnectionCapabilities2 mCapabilities2
Capabilities mCapabilities
virtual void vacuum(const QString &schema, const QString &name) const
Vacuum the database table with given schema and name (schema is ignored if not supported by the backe...
QSet< QString > mIllegalFieldNames
virtual QList< Qgis::FieldDomainType > supportedFieldDomainTypes() const
Returns a list of field domain types which are supported by the provider.
virtual void renameVectorTable(const QString &schema, const QString &name, const QString &newName) const
Renames a vector or aspatial table with given schema (schema is ignored if not supported by the backe...
QString providerKey() const
Returns the provider key.
virtual void createSchema(const QString &name) const
Creates a new schema with the specified name.
virtual void deleteSpatialIndex(const QString &schema, const QString &name, const QString &geometryColumn) const
Deletes the existing spatial index for the database table with given schema, name and geometryColumn ...
virtual void dropRasterTable(const QString &schema, const QString &name) const
Drops a raster table with given schema (schema is ignored if not supported by the backend) and name.
Qgis::DatabaseProviderConnectionCapabilities2 capabilities2() const
Returns extended connection capabilities.
virtual QueryResult execSql(const QString &sql, QgsFeedback *feedback=nullptr) const
Executes raw sql and returns the (possibly empty) query results, optionally feedback can be provided.
virtual QgsProviderSqlQueryBuilder * queryBuilder() const
Returns a SQL query builder for the connection, which provides an interface for provider-specific cre...
virtual void setFieldDomainName(const QString &fieldName, const QString &schema, const QString &tableName, const QString &domainName) const
Sets the field domain name for the existing field with the specified name.
virtual void deleteField(const QString &fieldName, const QString &schema, const QString &tableName, bool force=false) const
Deletes the field with the specified name.
virtual QString tableUri(const QString &schema, const QString &name) const
Returns the URI string for the given table and schema.
QFlags< TableFlag > TableFlags
QFlags< GeometryColumnCapability > GeometryColumnCapabilities
virtual void deleteRelationship(const QgsWeakRelation &relationship) const
Deletes an existing relationship in the database.
Capability
The Capability enum represents the operations supported by the connection.
@ RetrieveFieldDomain
Can retrieve field domain details from provider via fieldDomain().
@ CreateSpatialIndex
The connection can create spatial indices.
@ AddRelationship
Can add new relationships to the database via addRelationship().
@ SqlLayers
Can create vector layers from SQL SELECT queries.
@ RenameSchema
Can RENAME a schema.
@ DropVectorTable
Can DROP a vector (or aspatial) table/layer.
@ DeleteSpatialIndex
The connection can delete spatial indices for tables.
@ RetrieveRelationships
Can retrieve relationships from the database.
@ RenameRasterTable
Can RENAME a raster table/layer.
@ SetFieldDomain
Can set the domain for an existing field via setFieldDomainName().
@ DropSchema
Can DROP a schema.
@ AddFieldDomain
Can add new field domains to the database via addFieldDomain().
@ DeleteRelationship
Can delete existing relationships from the database via deleteRelationship().
@ CreateSchema
Can CREATE a schema.
@ DropRasterTable
Can DROP a raster table/layer.
@ DeleteField
Can delete an existing field/column.
@ AddField
Can add a new field/column.
@ TableExists
Can check if table exists.
@ RenameVectorTable
Can RENAME a vector (or aspatial) table/layer.
@ RenameField
Can rename existing fields via renameField().
@ MoveTableToSchema
Can move table to another schema via moveTableToAnotherSchema().
@ ExecuteSql
Can execute raw SQL queries (without returning results).
@ UpdateRelationship
Can update existing relationships in the database via updateRelationship().
@ SpatialIndexExists
The connection can determine if a spatial index exists.
@ ListFieldDomains
Can return a list of field domain names via fieldDomainNames().
@ Schemas
Can list schemas (if not set, the connection does not support schemas).
virtual void createSpatialIndex(const QString &schema, const QString &name, const QgsAbstractDatabaseProviderConnection::SpatialIndexOptions &options=QgsAbstractDatabaseProviderConnection::SpatialIndexOptions()) const
Creates a spatial index for the database table with given schema and name (schema is ignored if not s...
virtual QStringList relatedTableTypes() const
Returns a list of the related table types supported by the database format.
static bool splitSimpleQuery(const QString &sql, QStringList &columns, QStringList &tables, QString &where)
Splits a simple query in the form "SELECT column(s) FROM table(s) [WHERE ...]" into its components.
GeometryColumnCapabilities mGeometryColumnCapabilities
virtual GeometryColumnCapabilities geometryColumnCapabilities()
Returns connection geometry column capabilities (Z, M, SinglePart, Curves).
virtual Qgis::SqlLayerDefinitionCapabilities sqlLayerDefinitionCapabilities()
Returns SQL layer definition capabilities (Filters, GeometryColumn, PrimaryKeys).
virtual void renameRasterTable(const QString &schema, const QString &name, const QString &newName) const
Renames a raster table with given schema (schema is ignored if not supported by the backend) and name...
virtual void dropVectorTable(const QString &schema, const QString &name) const
Drops a vector (or aspatial) table with given schema (schema is ignored if not supported by the backe...
virtual QStringList fieldDomainNames() const
Returns a list of field domain names present on the provider.
virtual void setFieldAlias(const QString &fieldName, const QString &schema, const QString &tableName, const QString &alias) const
Sets the alias for the existing field with the specified name.
virtual void renameSchema(const QString &name, const QString &newName) const
Renames a schema with the specified name.
virtual void addFieldDomain(const QgsFieldDomain &domain, const QString &schema) const
Adds a new field domain to the database.
virtual QList< QList< QVariant > > executeSql(const QString &sql, QgsFeedback *feedback=nullptr) const
Executes raw sql and returns the (possibly empty) list of results in a multi-dimensional array,...
virtual bool spatialIndexExists(const QString &schema, const QString &name, const QString &geometryColumn) const
Determines whether a spatial index exists for the database table with given schema,...
virtual QgsAbstractDatabaseProviderConnection::TableProperty table(const QString &schema, const QString &table, QgsFeedback *feedback=nullptr) const
Returns information on a table in the given schema.
virtual QMultiMap< Qgis::SqlKeywordCategory, QStringList > sqlDictionary()
Returns a dictionary of SQL keywords supported by the provider.
virtual Qgis::RelationshipCapabilities supportedRelationshipCapabilities() const
Returns the relationship capabilities supported by the provider.
virtual SqlVectorLayerOptions sqlOptions(const QString &layerSource)
Returns the SQL layer options from a layerSource.
QFlags< Capability > Capabilities
virtual QSet< QString > illegalFieldNames() const
Returns a list of field names which are considered illegal by the connection and should not be used w...
virtual QStringList schemas() const
Returns information about the existing schemas.
virtual QList< Qgis::RelationshipCardinality > supportedRelationshipCardinalities() const
Returns a list of relationship cardinalities which are supported by the provider.
virtual QString createVectorLayerExporterDestinationUri(const QgsAbstractDatabaseProviderConnection::VectorLayerExporterOptions &options, QVariantMap &providerOptions) const
Creates a URI for use with QgsVectorLayerExporter corresponding to given destination table options fo...
virtual void moveTableToSchema(const QString &sourceSchema, const QString &tableName, const QString &targetSchema) const
Move table to a different schema.
virtual QList< Qgis::RelationshipStrength > supportedRelationshipStrengths() const
Returns a list of relationship strengths which are supported by the provider.
virtual QList< QgsLayerMetadataProviderResult > searchLayerMetadata(const QgsMetadataSearchContext &searchContext, const QString &searchString=QString(), const QgsRectangle &geographicExtent=QgsRectangle(), QgsFeedback *feedback=nullptr) const
Search the stored layer metadata in the connection, optionally limiting the search to the metadata id...
virtual void addRelationship(const QgsWeakRelation &relationship) const
Adds a new field relationship to the database.
virtual void updateFieldDomain(QgsFieldDomain *domain, const QString &schema) const
Update an existing field domain in the database, the domain is identified by name.
virtual QgsFieldDomain * fieldDomain(const QString &name) const
Returns the field domain with the specified name from the provider.
QgsAbstractDatabaseProviderConnection(const QString &name)
Creates a new connection with name by reading its configuration from the settings.
virtual void setTableComment(const QString &schema, const QString &tableName, const QString &comment) const
Sets the comment for the existing table with the specified name.
virtual QString defaultPrimaryKeyColumnName() const
Returns the default name to use for a primary key column for the connection.
virtual bool validateSqlVectorLayer(const SqlVectorLayerOptions &options, QString &message) const
Validates the SQL query options to determine if it is possible to create a vector layer based on a SQ...
Capabilities capabilities() const
Returns connection capabilities.
virtual QgsFields fields(const QString &schema, const QString &table, QgsFeedback *feedback=nullptr) const
Returns the fields of a table and schema.
QVariantMap configuration() const
Returns the connection configuration parameters.
QgsAbstractProviderConnection(const QString &name)
Creates a new connection with name by reading its configuration from the settings.
QString uri() const
Returns the connection data source URI string representation.
Represents a coordinate reference system (CRS).
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const
Tells whether the operation has been canceled already.
Base class for field domains.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
QString publicSource(bool hidePassword=false) const
Gets a version of the internal layer definition that has sensitive bits removed (for example,...
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.
QList< QgsSQLStatement::NodeColumnSorted * > orderBy() const
Returns the list of order by columns.
QList< QgsSQLStatement::NodeSelectedColumn * > columns() const
Returns the list of columns.
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.
bool hasParserError() const
Returns true if an error occurred when parsing the input statement.
const QgsSQLStatement::Node * rootNode() const
Returns the root node of the statement.
Represents a vector layer which manages a vector based dataset.
Represent a QgsRelation with possibly unresolved layers or unmatched fields.
static Q_INVOKABLE int coordDimensions(Qgis::WkbType type)
Returns the coordinate dimension of the geometry type as an integer.
@ UnknownCount
Provider returned an unknown feature count.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
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.
The SqlVectorLayerOptions stores all information required to create a SQL (query) layer.
The GeometryColumnType struct represents the combination of geometry type and CRS for the table geome...
The TableProperty class represents a database table or view.
void setTableName(const QString &name)
Sets the table name to name.
QString geometryColumn() const
Returns the geometry column name.
bool operator==(const QgsAbstractDatabaseProviderConnection::TableProperty &other) const
void setPrimaryKeyColumns(const QStringList &primaryKeyColumns)
Sets the primary key column names to primaryKeyColumns.
void setFlag(const TableFlag &flag)
Sets a flag.
QString defaultName() const
Returns the default name for the table entry.
QList< QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType > geometryColumnTypes() const
Returns the list of geometry column types and CRSs.
void setGeometryColumn(const QString &geometryColumn)
Sets the geometry column name to geometryColumn.
TableProperty at(int index) const
Returns the table property corresponding to the geometry type at the given index.
int maxCoordinateDimensions() const
Returns the maximum coordinate dimensions of the geometries of a vector table.
QString tableName() const
Returns the table name.
int geometryColumnCount() const
Returns the number of geometry columns in the original table this entry refers to.
QList< QgsCoordinateReferenceSystem > crsList() const
Returns the list of CRSs supported by the geometry column.
void setSchema(const QString &schema)
Sets the schema.
QVariantMap info() const
Returns additional information about the table.
QString comment() const
Returns the table comment.
void setInfo(const QVariantMap &info)
Sets additional information about the table to info.
QStringList primaryKeyColumns() const
Returns the list of primary key column names.
void setGeometryColumnTypes(const QList< QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType > &geometryColumnTypes)
Sets the geometry column types to geometryColumnTypes.
void setComment(const QString &comment)
Sets the table comment.
QString schema() const
Returns the schema or an empty string for backends that do not support a schema.
TableFlags flags() const
Returns the table flags.
void setGeometryColumnCount(int geometryColumnCount)
Sets the geometryColumnCount.
void setFlags(const TableFlags &flags)
Sets the table flags.
void addGeometryColumnType(Qgis::WkbType type, const QgsCoordinateReferenceSystem &crs)
Appends the geometry column type with the given srid to the geometry column types list.
Stores all information required to create a QgsVectorLayerExporter for the backend.
Setting options for loading vector layers.
bool skipCrsValidation
Controls whether the layer is allowed to have an invalid/unknown CRS.