def get_con_configuration():
"""
Returns a tuple containing the currently active connection configuration.
The method uses the configuration name stored in the attribute
'current_server' to retrieve the configuration values from the
dictionary 'server_configuration'.
Returns
-------
tup : tuple or None
If there is a configuration for the currently selected server,
the method returns the tuple (db_host, db_port, db_name,
db_password). If no configuration is available, the method
returns None.
"""
if cfg.current_server in cfg.server_configuration:
d = cfg.server_configuration[cfg.current_server]
if d["type"] == SQL_MYSQL:
return (d["host"], d["port"], d["type"], d["user"], d["password"])
elif d["type"] == SQL_SQLITE:
return (None, None, SQL_SQLITE, None, None)
else:
return None
评论列表
文章目录