Class: QgsAuthConfigurationStorageDb¶
QSqlDatabase based implementation of
QgsAuthConfigurationStorage.
Added in version 3.40.
Class Hierarchy¶
Base classes¶
Abstract class that defines the interface for all authentication configuration storage implementations.  | 
|
Methods
Returns the database connection used by this storage.  | 
|
Opens the connction to the database.  | 
|
Runs the specified query on the database.  | 
|
Executes the specified query on the database using a transaction.  | 
|
Returns the name of the table used to store the auth settings.  | 
|
Returns the name of the table used to store the certificate authorities.  | 
|
Returns the name of the table used to store the certificate identities.  | 
|
Returns the name of the table used to store the certificate trust policies.  | 
|
Checks the capabilities of the storage.  | 
|
Creates the certificate tables in the database.  | 
|
Creates the configuration tables in the database.  | 
|
Returns the name of the table used to store the master passwords.  | 
|
Returns the name of the table used to store the method configurations.  | 
|
Returns the quoted identifier, prefixed with the schema (if not null), ready for the insertion into a SQL query.  | 
|
Returns the name of the table used to store the SSL custom configurations.  | 
|
Returns   | 
- class qgis.core.QgsAuthConfigurationStorageDb[source]¶
 Bases:
QgsAuthConfigurationStorage- __init__(settings: Dict[str | None, Any])
 Creates a new QgsAuthConfigurationStorageDb instance from the specified
settings. Settings can contain the following keys:Mandatory settings:
driver: the database driver to use (default is “QSQLITE”, see: https://doc.qt.io/qt-6/sql-driver.html)
database: the database name (or path in case of QSQLITE)
Optional settings:
host: the database host
user: the database user
password: the database password
port: the database port
schema: the database schema for all the tables (ignored if not supported)
options: the database connection options (see: https://doc.qt.io/qt-6/qsqldatabase.html#setConnectOptions)
Note
Even if this generic storage also works with a pre-existing SQLite DB, a convenience subclass
QgsAuthConfigurationStorageSqliteis provided for SQLite DBs.- Parameters:
 settings (Dict[Optional[str], Any])
- __init__(uri: str | None)
 Creates a new QgsAuthConfigurationStorageDb instance from the specified
uri. The URI should be in the format: verbatim<DRIVER>://<USER>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>[?OPTIONS]endverbatimNote
It is not possible to set the schema in the URI, pass SCHEMA=verbatim<SCHEMA>endverbatim in the options instead.
- Parameters:
 uri (Optional[str])
- authDatabaseConnection(self) QSqlDatabase[source]¶
 Returns the database connection used by this storage.
- Return type:
 QSqlDatabase
- authDbOpen(self) bool[source]¶
 Opens the connction to the database.
- Return type:
 bool
- Returns:
 Trueif the connection was opened successfully,Falseotherwise.
- authDbQuery(self, query: QSqlQuery | None, sql: str | None = '') bool[source]¶
 Runs the specified
queryon the database. Optionalsqlcan be provided.- Return type:
 bool
- Returns:
 Trueif the query was executed successfully,Falseotherwise.- Parameters:
 query (Optional[QSqlQuery])
sql (Optional[str] = '')
- authDbTransactionQuery(self, query: QSqlQuery | None) bool[source]¶
 Executes the specified
queryon the database using a transaction. Optionalsqlcan be provided.- Return type:
 bool
- Returns:
 Trueif the query was executed successfully,Falseotherwise.- Parameters:
 query (Optional[QSqlQuery])
- authSettingsTableName(self) str[source]¶
 Returns the name of the table used to store the auth settings.
- Return type:
 str
- certAuthorityTableName(self) str[source]¶
 Returns the name of the table used to store the certificate authorities.
- Return type:
 str
- certIdentityTableName(self) str[source]¶
 Returns the name of the table used to store the certificate identities.
- Return type:
 str
- certTrustPolicyTableName(self) str[source]¶
 Returns the name of the table used to store the certificate trust policies.
- Return type:
 str
- createCertTables(self) bool[source]¶
 Creates the certificate tables in the database.
- Return type:
 bool
- Returns:
 Trueif the tables were created successfully,Falseotherwise.
- createConfigTables(self) bool[source]¶
 Creates the configuration tables in the database.
- Return type:
 bool
- Returns:
 Trueif the tables were created successfully,Falseotherwise.
- masterPasswordTableName(self) str[source]¶
 Returns the name of the table used to store the master passwords.
- Return type:
 str
- methodConfigTableName(self) str[source]¶
 Returns the name of the table used to store the method configurations.
- Return type:
 str
- quotedQualifiedIdentifier(self, identifier: str | None, isIndex: bool = False) str[source]¶
 Returns the quoted identifier, prefixed with the schema (if not null), ready for the insertion into a SQL query.
- Parameters:
 identifier (Optional[str]) – the identifier to quote.
isIndex (bool = False) – if
True, the identifier is treated as an index name.
- Return type:
 str