dblogin – Login dialog for MySQL database¶
Login dialog for MySQL database.
Call dblogin.DBLoginDialog.openConnection()
to show a login dialog
box and connect using the values entered by the user.
Call dblogin.openConnection()
to login without user interaction.
Call dblogin.getDataSource()
to retrieve database parameters for
named databases.
- class solutions.gui.dblogin.ConnectionBox(**kwargs)[source]¶
Input box for common database parameters.
- class solutions.gui.dblogin.ConnectionDetailsBox(**kwargs)[source]¶
Input box for SSL related database parameters.
- class solutions.gui.dblogin.DBLoginDialog(**kwargs)[source]¶
Dialog box for entering database parameters.
The DBLoginDialog class allows the user to enter the database parameters required for connecting to a MySQL database server. A Test button makes it possible to test the parameters before continuing.
The static method openConnection() can be used to display the dialog and return a connection object.
- static openConnection(retry: bool = True, **kwargs)[source]¶
Display database login dialog and return connection.
- Parameters
retry – If true, repeat the dialog when connection fails.
**kwargs – passed to DBLoginDialog.__init__().
- Returns
An instance of QSqlDatabase, or None if no connection was established, for example because the user pressed Cancel.
- solutions.gui.dblogin.getDataSource()[source]¶
Return database parameter dict with the given nickname.
- Parameters
nickname – name of database configuration.
- Returns
A database parameter dictionary containing a subset of the following keys.
- nickname
Short nickname for the database.
- longname
Descriptive name for the database.
- host
Hostname or IP address.
- port
Port number, default 3306.
- database
Database name on server.
- user
User id.
- password
User password.
- ssl_key
Path to SSL client key.
- ssl_cert
Path to SSL client certificate.
- ssl_ca
Path to CA certificate.
- Return type