|
QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
|
Stores the component parts of a data source URI (e.g. More...
#include <qgsdatasourceuri.h>
Public Types | |
| enum | SslMode { SslPrefer , SslDisable , SslAllow , SslRequire , SslVerifyCa , SslVerifyFull } |
| Available SSL connection modes. More... | |
Public Member Functions | |
| QgsDataSourceUri () | |
| QgsDataSourceUri (const QByteArray &uri) | |
| Constructor for QgsDataSourceUri which parses an input encoded uri). | |
| QgsDataSourceUri (const QString &uri) | |
| Constructor for QgsDataSourceUri which parses an input uri string. | |
| QString | authConfigId () const |
| Returns any associated authentication configuration ID stored in the URI. | |
| void | clearSchema () |
| Clears the schema stored in the URI. | |
| QString | connectionInfo (bool expandAuthConfig=true) const |
| Returns the connection part of the URI. | |
| QString | database () const |
| Returns the database name stored in the URI. | |
| void | disableSelectAtId (bool flag) |
Set to true to disable selection by feature ID. | |
| QString | driver () const |
| Returns the driver name stored in the URI. | |
| QByteArray | encodedUri () const |
| Returns the complete encoded URI as a byte array. | |
| QString | geometryColumn () const |
| Returns the name of the geometry column stored in the URI, if set. | |
| bool | hasParam (const QString &key) const |
Returns true if a parameter with the specified key exists. | |
| QString | host () const |
| Returns the host name stored in the URI. | |
| QString | httpHeader (const QString &key) |
| Returns the http header value according to key. | |
| QgsHttpHeaders & | httpHeaders () |
| Returns http headers. | |
| QgsHttpHeaders | httpHeaders () const |
| Returns http headers. | |
| QString | keyColumn () const |
| Returns the name of the (primary) key column for the referenced table. | |
| bool | operator!= (const QgsDataSourceUri &other) const |
| bool | operator== (const QgsDataSourceUri &other) const |
| QString | param (const QString &key) const |
| Returns a generic parameter value corresponding to the specified key. | |
| QSet< QString > | parameterKeys () const |
| Returns parameter keys used in the uri: specialized ones ("table", "schema", etc.) or generic parameters. | |
| QStringList | params (const QString &key) const |
| Returns multiple generic parameter values corresponding to the specified key. | |
| QString | password () const |
| Returns the password stored in the URI. | |
| QString | port () const |
| Returns the port stored in the URI. | |
| QString | quotedTablename () const |
| Returns the URI's table name, escaped and quoted. | |
| int | removeParam (const QString &key) |
| Removes a generic parameter by key. | |
| QString | schema () const |
| Returns the schema stored in the URI. | |
| bool | selectAtIdDisabled () const |
| Returns whether the selection by feature ID is disabled. | |
| QString | service () const |
| Returns the service name associated with the URI. | |
| void | setAuthConfigId (const QString &authcfg) |
| Sets the authentication configuration ID for the URI. | |
| 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 a service case). | |
| void | setDatabase (const QString &database) |
| Sets the URI database name. | |
| 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 stored in the URI. | |
| void | setEncodedUri (const QByteArray &uri) |
| Sets the complete encoded uri. | |
| void | setEncodedUri (const QString &uri) |
| Sets the complete encoded uri from a string value. | |
| void | setGeometryColumn (const QString &geometryColumn) |
| Sets geometry column name to geometryColumn. | |
| void | setHost (const QString &host) |
| Sets the host name stored in the URI. | |
| void | setHttpHeaders (const QgsHttpHeaders &headers) |
| Sets headers to headers. | |
| void | setKeyColumn (const QString &column) |
| Sets the name of the (primary) key column. | |
| void | setParam (const QString &key, const QString &value) |
| Sets a generic parameter value on the URI. | |
| void | setParam (const QString &key, const QStringList &value) |
| Sets a generic parameter list value on the URI. | |
| void | setPassword (const QString &password) |
| Sets the password for the URI. | |
| void | setPort (const QString &port) |
| Sets the port stored in the URI. | |
| void | setSchema (const QString &schema) |
| Sets the scheme for the URI. | |
| void | setService (const QString &service) |
| Sets the service name associated with the URI. | |
| void | setSql (const QString &sql) |
| Sets the sql filter for the URI. | |
| void | setSrid (const QString &srid) |
| Sets the spatial reference ID associated with the URI. | |
| void | setSslMode (SslMode mode) |
| Sets the SSL mode associated with the URI. | |
| void | setTable (const QString &table) |
| Sets table to table. | |
| void | setUseEstimatedMetadata (bool flag) |
| Sets whether estimated metadata should be used for the connection. | |
| void | setUsername (const QString &username) |
| Sets the username for the URI. | |
| void | setWkbType (Qgis::WkbType type) |
| Sets the WKB type associated with the URI. | |
| QString | sql () const |
| Returns the SQL filter stored in the URI, if set. | |
| QString | srid () const |
| Returns the spatial reference ID associated with the URI. | |
| SslMode | sslMode () const |
| Returns the SSL mode associated with the URI. | |
| QString | table () const |
| Returns the table name stored in the URI. | |
| QString | uri (bool expandAuthConfig=true) const |
| Returns the complete URI as a string. | |
| bool | useEstimatedMetadata () const |
Returns true if estimated metadata should be used for the connection. | |
| QString | username () const |
| Returns the username stored in the URI. | |
| Qgis::WkbType | wkbType () const |
| Returns the WKB type associated with the URI. | |
Static Public Member Functions | |
| static SslMode | decodeSslMode (const QString &sslMode) |
| Decodes SSL mode string into enum value. | |
| static QString | encodeSslMode (SslMode sslMode) |
| Encodes SSL mode enum value into a string. | |
| static QString | removePassword (const QString &aUri, bool hide=false) |
| Removes the password element from a URI. | |
Stores the component parts of a data source URI (e.g.
a Postgres data source).
This structure stores the database connection information, including host, database, user name, password, schema, password, and SQL where clause.
Definition at line 40 of file qgsdatasourceuri.h.
Available SSL connection modes.
| Enumerator | |
|---|---|
| SslPrefer | |
| SslDisable | |
| SslAllow | |
| SslRequire | |
| SslVerifyCa | |
| SslVerifyFull | |
Definition at line 47 of file qgsdatasourceuri.h.
| QgsDataSourceUri::QgsDataSourceUri | ( | ) |
Definition at line 38 of file qgsdatasourceuri.cpp.
| QgsDataSourceUri::QgsDataSourceUri | ( | const QString & | uri | ) |
Constructor for QgsDataSourceUri which parses an input uri string.
Definition at line 43 of file qgsdatasourceuri.cpp.
| QgsDataSourceUri::QgsDataSourceUri | ( | const QByteArray & | uri | ) |
Constructor for QgsDataSourceUri which parses an input encoded uri).
| QString QgsDataSourceUri::authConfigId | ( | ) | const |
Returns any associated authentication configuration ID stored in the URI.
Definition at line 331 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::clearSchema | ( | ) |
Clears the schema stored in the URI.
Definition at line 470 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::connectionInfo | ( | bool | expandAuthConfig = true | ) | const |
Returns the connection part of the URI.
Definition at line 574 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::database | ( | ) | const |
Returns the database name stored in the URI.
Definition at line 356 of file qgsdatasourceuri.cpp.
|
static |
Decodes SSL mode string into enum value.
If the string is not recognized, SslPrefer is returned.
Definition at line 835 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::disableSelectAtId | ( | bool | flag | ) |
Set to true to disable selection by feature ID.
Definition at line 449 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::driver | ( | ) | const |
Returns the driver name stored in the URI.
Definition at line 391 of file qgsdatasourceuri.cpp.
| QByteArray QgsDataSourceUri::encodedUri | ( | ) | const |
Returns the complete encoded URI as a byte array.
Definition at line 708 of file qgsdatasourceuri.cpp.
|
static |
Encodes SSL mode enum value into a string.
Definition at line 853 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::geometryColumn | ( | ) | const |
Returns the name of the geometry column stored in the URI, if set.
Definition at line 416 of file qgsdatasourceuri.cpp.
| bool QgsDataSourceUri::hasParam | ( | const QString & | key | ) | const |
Returns true if a parameter with the specified key exists.
Definition at line 944 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::host | ( | ) | const |
Returns the host name stored in the URI.
Definition at line 351 of file qgsdatasourceuri.cpp.
|
inline |
Returns the http header value according to key.
Definition at line 385 of file qgsdatasourceuri.h.
|
inline |
|
inline |
Returns http headers.
Definition at line 372 of file qgsdatasourceuri.h.
| QString QgsDataSourceUri::keyColumn | ( | ) | const |
Returns the name of the (primary) key column for the referenced table.
Definition at line 421 of file qgsdatasourceuri.cpp.
| bool QgsDataSourceUri::operator!= | ( | const QgsDataSourceUri & | other | ) | const |
Definition at line 1036 of file qgsdatasourceuri.cpp.
| bool QgsDataSourceUri::operator== | ( | const QgsDataSourceUri & | other | ) | const |
Definition at line 1001 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::param | ( | const QString & | key | ) | const |
Returns a generic parameter value corresponding to the specified key.
Definition at line 918 of file qgsdatasourceuri.cpp.
| QSet< QString > QgsDataSourceUri::parameterKeys | ( | ) | const |
Returns parameter keys used in the uri: specialized ones ("table", "schema", etc.) or generic parameters.
Definition at line 957 of file qgsdatasourceuri.cpp.
| QStringList QgsDataSourceUri::params | ( | const QString & | key | ) | const |
Returns multiple generic parameter values corresponding to the specified key.
Definition at line 931 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::password | ( | ) | const |
Returns the password stored in the URI.
Definition at line 366 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::port | ( | ) | const |
Returns the port stored in the URI.
Definition at line 386 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::quotedTablename | ( | ) | const |
Returns the URI's table name, escaped and quoted.
Definition at line 767 of file qgsdatasourceuri.cpp.
| int QgsDataSourceUri::removeParam | ( | const QString & | key | ) |
Removes a generic parameter by key.
Definition at line 897 of file qgsdatasourceuri.cpp.
|
static |
Removes the password element from a URI.
| aUri | A data source uri |
| hide | true to replace the password value with 'xxxxxxxx', false to remove password (key and value) (since QGIS 3.34) |
Definition at line 239 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::schema | ( | ) | const |
Returns the schema stored in the URI.
Definition at line 401 of file qgsdatasourceuri.cpp.
| bool QgsDataSourceUri::selectAtIdDisabled | ( | ) | const |
Returns whether the selection by feature ID is disabled.
Definition at line 455 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::service | ( | ) | const |
Returns the service name associated with the URI.
Definition at line 346 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setAuthConfigId | ( | const QString & | authcfg | ) |
Sets the authentication configuration ID for the URI.
Definition at line 805 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::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.
Definition at line 775 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::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 a service case).
Definition at line 786 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setDatabase | ( | const QString & | database | ) |
Sets the URI database name.
Definition at line 810 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::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.
The aSql argument represents a subset filter string to be applied to the source, and should take the form of a SQL "where" clause (e.g. "VALUE > 5", "CAT IN (1,2,3)").
Definition at line 796 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setDriver | ( | const QString & | driver | ) |
Sets the driver name stored in the URI.
Definition at line 427 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setEncodedUri | ( | const QByteArray & | uri | ) |
Sets the complete encoded uri.
Definition at line 730 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setEncodedUri | ( | const QString & | uri | ) |
Sets the complete encoded uri from a string value.
Definition at line 760 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setGeometryColumn | ( | const QString & | geometryColumn | ) |
Sets geometry column name to geometryColumn.
Definition at line 490 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setHost | ( | const QString & | host | ) |
Sets the host name stored in the URI.
Definition at line 465 of file qgsdatasourceuri.cpp.
|
inline |
| void QgsDataSourceUri::setKeyColumn | ( | const QString & | column | ) |
Sets the name of the (primary) key column.
Definition at line 433 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setParam | ( | const QString & | key, |
| const QString & | value ) |
Sets a generic parameter value on the URI.
Definition at line 873 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setParam | ( | const QString & | key, |
| const QStringList & | value ) |
Sets a generic parameter list value on the URI.
Definition at line 889 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setPassword | ( | const QString & | password | ) |
Sets the password for the URI.
Definition at line 381 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setPort | ( | const QString & | port | ) |
Sets the port stored in the URI.
Definition at line 361 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setSchema | ( | const QString & | schema | ) |
Sets the scheme for the URI.
Definition at line 475 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setService | ( | const QString & | service | ) |
Sets the service name associated with the URI.
Definition at line 376 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setSql | ( | const QString & | sql | ) |
Sets the sql filter for the URI.
The sql represents a subset filter string to be applied to the source, and should take the form of a SQL "where" clause (e.g. "VALUE > 5", "CAT IN (1,2,3)").
Definition at line 460 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setSrid | ( | const QString & | srid | ) |
Sets the spatial reference ID associated with the URI.
Definition at line 830 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setSslMode | ( | SslMode | mode | ) |
Sets the SSL mode associated with the URI.
Definition at line 371 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setTable | ( | const QString & | table | ) |
| void QgsDataSourceUri::setUseEstimatedMetadata | ( | bool | flag | ) |
Sets whether estimated metadata should be used for the connection.
Definition at line 439 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setUsername | ( | const QString & | username | ) |
Sets the username for the URI.
Definition at line 341 of file qgsdatasourceuri.cpp.
| void QgsDataSourceUri::setWkbType | ( | Qgis::WkbType | type | ) |
Sets the WKB type associated with the URI.
Definition at line 820 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::sql | ( | ) | const |
Returns the SQL filter stored in the URI, if set.
This represents a subset filter string to be applied to the source, and takes the form of a SQL "where" clause (e.g. "VALUE > 5", "CAT IN (1,2,3)").
Definition at line 411 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::srid | ( | ) | const |
Returns the spatial reference ID associated with the URI.
Definition at line 825 of file qgsdatasourceuri.cpp.
| QgsDataSourceUri::SslMode QgsDataSourceUri::sslMode | ( | ) | const |
Returns the SSL mode associated with the URI.
Definition at line 396 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::table | ( | ) | const |
Returns the table name stored in the URI.
Definition at line 406 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::uri | ( | bool | expandAuthConfig = true | ) | const |
Returns the complete URI as a string.
Definition at line 636 of file qgsdatasourceuri.cpp.
| bool QgsDataSourceUri::useEstimatedMetadata | ( | ) | const |
Returns true if estimated metadata should be used for the connection.
Definition at line 444 of file qgsdatasourceuri.cpp.
| QString QgsDataSourceUri::username | ( | ) | const |
Returns the username stored in the URI.
Definition at line 336 of file qgsdatasourceuri.cpp.
| Qgis::WkbType QgsDataSourceUri::wkbType | ( | ) | const |
Returns the WKB type associated with the URI.
Definition at line 815 of file qgsdatasourceuri.cpp.