19#ifndef QGSDATASOURCEURI_H
20#define QGSDATASOURCEURI_H
31using namespace Qt::StringLiterals;
80 QString
uri(
bool expandAuthConfig =
true )
const;
109 void setParam(
const QString &key,
const QString &value );
115 void setParam(
const QString &key,
const QStringList &value )
SIP_PYNAME( setParamList );
126 QString
param(
const QString &key )
const;
131 QStringList
params(
const QString &key )
const;
136 bool hasParam(
const QString &key )
const;
142 const QString &aPort,
143 const QString &aDatabase,
144 const QString &aUsername,
145 const QString &aPassword,
153 const QString &aDatabase,
154 const QString &aUsername,
155 const QString &aPassword,
171 const QString &aTable,
172 const QString &aGeometryColumn,
173 const QString &aSql = QString(),
174 const QString &aKeyColumn = QString() );
199 static QString
removePassword(
const QString &aUri,
bool hide =
false );
213 QString
table()
const;
271 QString
host()
const;
289 QString
port()
const;
349 QString
srid()
const;
399 QString
httpHeader(
const QString &key ) {
return mHttpHeaders[key].toString(); }
408 SIP_PYOBJECT __repr__();
410 QString str = u
"<QgsDataSourceUri: %1>"_s.arg( sipCpp->uri(
false ) );
411 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
419 void skipBlanks(
const QString &uri,
int &i );
420 QString getValue(
const QString &uri,
int &i );
421 QString escape(
const QString &uri, QChar delim )
const;
440 QString mGeometryColumn;
444 QString mAuthConfigId;
450 SslMode mSSLmode = SslPrefer;
454 bool mUseEstimatedMetadata =
false;
456 bool mSelectAtIdDisabled =
false;
458 bool mSelectAtIdDisabledSet =
false;
464 QMultiMap<QString, QString> mParams;
WkbType
The WKB type describes the number of dimensions a geometry has.
Stores the component parts of a data source URI (e.g.
QString srid() const
Returns the spatial reference ID associated with the URI.
SslMode
Available SSL connection modes.
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.
QByteArray encodedUri() const
Returns the complete encoded URI as a byte array.
QStringList params(const QString &key) const
Returns multiple generic parameter values corresponding to the specified key.
void setSchema(const QString &schema)
Sets the scheme for the URI.
bool hasParam(const QString &key) const
Returns true if a parameter with the specified key exists.
int removeParam(const QString &key)
Removes a generic parameter by key.
static SslMode decodeSslMode(const QString &sslMode)
Decodes SSL mode string into enum value.
void setSql(const QString &sql)
Sets the sql filter for the URI.
void setEncodedUri(const QByteArray &uri)
Sets the complete encoded uri.
QgsDataSourceUri(const QByteArray &uri)
Constructor for QgsDataSourceUri which parses an input encoded uri).
QString table() const
Returns the table name stored in the URI.
void setTable(const QString &table)
Sets table to table.
void setAuthConfigId(const QString &authcfg)
Sets the authentication configuration ID for the URI.
QString quotedTablename() const
Returns the URI's table name, escaped and quoted.
void setGeometryColumn(const QString &geometryColumn)
Sets geometry column name to geometryColumn.
QString schema() const
Returns the schema stored in the URI.
void setUseEstimatedMetadata(bool flag)
Sets whether estimated metadata should be used for the connection.
QString connectionInfo(bool expandAuthConfig=true) const
Returns the connection part of the URI.
QgsHttpHeaders httpHeaders() const
Returns http headers.
QString uri(bool expandAuthConfig=true) const
Returns the complete URI as a string.
void setUsername(const QString &username)
Sets the username for the URI.
QString param(const QString &key) const
Returns a generic parameter value corresponding to the specified key.
void disableSelectAtId(bool flag)
Set to true to disable selection by feature ID.
bool selectAtIdDisabled() const
Returns whether the selection by feature ID is disabled.
void setHost(const QString &host)
Sets the host name stored in the URI.
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.
QString username() const
Returns the username stored in the URI.
void setService(const QString &service)
Sets the service name associated with the URI.
static QString encodeSslMode(SslMode sslMode)
Encodes SSL mode enum value into a string.
Qgis::WkbType wkbType() const
Returns the WKB type associated with the URI.
void setSslMode(SslMode mode)
Sets the SSL mode associated with the URI.
void setWkbType(Qgis::WkbType type)
Sets the WKB type associated with the URI.
QString driver() const
Returns the driver name stored in the URI.
QString host() const
Returns the host name stored in the URI.
void setPort(const QString &port)
Sets the port stored in the URI.
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
QString service() const
Returns the service name associated with the URI.
void setKeyColumn(const QString &column)
Sets the name of the (primary) key column.
bool useEstimatedMetadata() const
Returns true if estimated metadata should be used for the connection.
QgsHttpHeaders & httpHeaders()
Returns http headers.
SslMode sslMode() const
Returns the SSL mode associated with the URI.
QString password() const
Returns the password stored in the URI.
QString keyColumn() const
Returns the name of the (primary) key column for the referenced table.
QString authConfigId() const
Returns any associated authentication configuration ID stored in the URI.
QString port() const
Returns the port stored in the URI.
QSet< QString > parameterKeys() const
Returns parameter keys used in the uri: specialized ones ("table", "schema", etc.) or generic paramet...
QString database() const
Returns the database name stored in the URI.
void clearSchema()
Clears the schema stored in the URI.
void setDriver(const QString &driver)
Sets the driver name stored in the URI.
static QString removePassword(const QString &aUri, bool hide=false)
Removes the password element from a URI.
void setHttpHeaders(const QgsHttpHeaders &headers)
Sets headers to headers.
void setDatabase(const QString &database)
Sets the URI database name.
QString geometryColumn() const
Returns the name of the geometry column stored in the URI, if set.
void setSrid(const QString &srid)
Sets the spatial reference ID associated with the URI.
QString httpHeader(const QString &key)
Returns the http header value according to key.
QString sql() const
Returns the SQL filter stored in the URI, if set.
void setPassword(const QString &password)
Sets the password for the URI.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)