def connect(self):
"""connects to the database"""
self.conn = mdb.connect(
host = self.config["db"]["host"],
user = self.config["db"]["user"],
passwd = self.config["db"]["password"],
db = self.config["db"]["database"],
port = self.config["db"].get("port", 3306),
use_unicode = True,
charset = "utf8")
# checks whether this is a ViewVC database instead of a Bonsai database
cursor = self.conn.cursor()
cursor.execute("show tables like 'commits'")
self.is_viewvc_database = (cursor.rowcount == 1)
cursor.execute("SET SESSION innodb_lock_wait_timeout = 500")
cursor.close()
self.conn.begin()
评论列表
文章目录