db.py 文件源码

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

项目:ravel 作者: ravel-net 项目源码 文件源码
def __init__(self, name, user, base, passwd=None, reconnect=False):
        """name: the name of the database to connect to
           user: the username to use to connect
           base: a file containing the SQL implementation for Ravel's base
           passwd: the password to connect to the database
           reconnect: true to connect to an existing database setup, false
           to load a new instance of Ravel's base into the database"""
        self.name = name
        self.user = user
        self.passwd = passwd
        self.base = base
        self.cleaned = not reconnect
        self._cursor = None
        self._conn = None

        if not reconnect and self.num_connections() > 0:
            logger.warning("existing connections to database, skipping reinit")
            self.cleaned = False
        elif not reconnect:
            self.init()
            self.cleaned = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号