QgsDataSourceUri class
Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
Contents
This structure stores the database connection information, including host, database, user name, password, schema, password, and sql where clause
Extended to support generic params so that it may be used by any provider. The 2 modes (the old - RDMS specific and the new generic) may not yet be mixed.
Public static functions
- static auto decodeSslMode(const QString& sslMode) -> SslMode
- Decodes SSL mode string into enum value.
- static auto encodeSslMode(SslMode sslMode) -> QString
- Encodes SSL mode enum value into a string.
- static auto removePassword(const QString& aUri) -> QString
- Removes password element from uris.
Constructors, destructors, conversion operators
- QgsDataSourceUri()
- default constructor
- QgsDataSourceUri(QString uri)
- constructor which parses input URI
- QgsDataSourceUri(const QByteArray& uri)
- constructor which parses input encoded URI (generic mode)
Public functions
- auto authConfigId() const -> QString
- Any associated authentication configuration ID.
- void clearSchema()
- Clears the schema.
- auto connectionInfo(bool expandAuthConfig = true) const -> QString
- Returns connection part of URI.
- auto database() const -> QString
- Returns the database.
- void disableSelectAtId(bool flag)
- Sets to true to disable selection by id.
- auto driver() const -> QString
- Returns the driver.
- auto encodedUri() const -> QByteArray
- Returns complete encoded uri (generic mode)
- auto geometryColumn() const -> QString
- Returns the name of the geometry column.
- auto hasParam(const QString& key) const -> bool
- Test if param exists (generic mode)
- auto host() const -> QString
- Returns the host.
- auto keyColumn() const -> QString
- Returns the name of the (primary) key column.
- auto param(const QString& key) const -> QString
- Gets generic param (generic mode)
- auto params(const QString& key) const -> QStringList
- Gets multiple generic param (generic mode)
- auto password() const -> QString
- Returns the password.
- auto port() const -> QString
- Returns the port.
- auto quotedTablename() const -> QString
- quoted table name
- auto removeParam(const QString& key) -> int
- Remove generic param (generic mode)
- auto schema() const -> QString
- Returns the schema.
- auto selectAtIdDisabled() const -> bool
- Returns whether the selection by id is disabled.
- auto service() const -> QString
- Returns the service name.
- void setAuthConfigId(const QString& authcfg)
- Sets authentication configuration ID.
- void setConnection(const QString& aHost, const QString& aPort, const QString& aDatabase, const QString& aUsername, const QString& aPassword, SslMode sslmode = SslPrefer, const QString& authConfigId = QString())
- Sets all connection related members at once.
- void setConnection(const QString& aService, const QString& aDatabase, const QString& aUsername, const QString& aPassword, SslMode sslmode = SslPrefer, const QString& authConfigId = QString())
- Sets all connection related members at once (for the service case)
- void setDatabase(const QString& database)
- Sets database.
- void setDataSource(const QString& aSchema, const QString& aTable, const QString& aGeometryColumn, const QString& aSql = QString(), const QString& aKeyColumn = QString())
- Sets all data source related members at once.
- void setDriver(const QString& driver)
- Sets the driver name.
- void setEncodedUri(const QByteArray& uri)
- set complete encoded uri (generic mode)
- void setEncodedUri(const QString& uri)
- Sets complete encoded uri (generic mode)
- void setKeyColumn(const QString& column)
- Sets the name of the (primary) key column.
- void setParam(const QString& key, const QString& value)
- Set generic param (generic mode)
- void setParam(const QString& key, const QStringList& value)
- void setPassword(const QString& password)
- Sets password.
- void setSchema(const QString& schema)
- Sets the table schema.
- void setSql(const QString& sql)
- Sets the SQL query.
- void setSrid(const QString& srid)
- Sets the srid.
- void setUseEstimatedMetadata(bool flag)
- Sets use Estimated Metadata.
- void setUsername(const QString& username)
- Sets username.
-
void setWkbType(QgsWkbTypes::
Type type) - Sets the wkb type.
- auto sql() const -> QString
- Returns the SQL query.
- auto srid() const -> QString
- Returns the srid.
- auto sslMode() const -> SslMode
- Returns the SSL mode.
- auto table() const -> QString
- Returns the table.
- auto uri(bool expandAuthConfig = true) const -> QString
- Returns complete uri.
- auto useEstimatedMetadata() const -> bool
- Returns true if estimated metadata are used.
- auto username() const -> QString
- Returns the username.
-
auto wkbType() const -> QgsWkbTypes::
Type - The wkb type.
Function documentation
static SslMode QgsDataSourceUri:: decodeSslMode(const QString& sslMode)
Decodes SSL mode string into enum value.
If the string is not recognized, SslPrefer is returned.
static QString QgsDataSourceUri:: encodeSslMode(SslMode sslMode)
Encodes SSL mode enum value into a string.
QgsDataSourceUri:: QgsDataSourceUri(const QByteArray& uri)
constructor which parses input encoded URI (generic mode)
int QgsDataSourceUri:: removeParam(const QString& key)
Remove generic param (generic mode)
void QgsDataSourceUri:: setEncodedUri(const QByteArray& uri)
set complete encoded uri (generic mode)
void QgsDataSourceUri:: setParam(const QString& key,
const QString& value)
Set generic param (generic mode)