options.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:coquery 作者: gkunter 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号