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
评论列表
文章目录