index ccf7803f990920f22f76b36ee48a1f842cf2b014..bb233ffea862551ad9cf5a79fa2c395222369b98 100644 (file)
-#$Id: back_mysql.py,v 1.75 2008-02-27 08:32:50 richard Exp $
#
# Copyright (c) 2003 Martynas Sklyzmantas, Andrey Lebedev <andrey@micro.lt>
#
# stupid MySQL bug requires us to drop all the tables first
for table in tables:
command = 'DROP TABLE `%s`'%table[0]
- if __debug__:
- logging.getLogger('hyperdb').debug(command)
+ self.log_debug(command)
cursor.execute(command)
command = "DROP DATABASE %s"%config.RDBMS_NAME
- logging.getLogger('hyperdb').info(command)
+ self.log_info(command)
cursor.execute(command)
conn.commit()
conn.close()
conn = MySQLdb.connect(**kwargs)
cursor = conn.cursor()
command = "CREATE DATABASE %s"%config.RDBMS_NAME
- logging.getLogger('hyperdb').info(command)
+ self.log_info(command)
cursor.execute(command)
conn.commit()
conn.close()
def sql_open_connection(self):
kwargs = connection_dict(self.config, 'db')
- logging.getLogger('hyperdb').info('open database %r'%(kwargs['db'],))
+ self.log_info('open database %r'%(kwargs['db'],))
try:
conn = MySQLdb.connect(**kwargs)
except MySQLdb.OperationalError, message:
def sql_commit(self, fail_ok=False):
''' Actually commit to the database.
'''
- logging.getLogger('hyperdb').info('commit')
+ self.log_info('commit')
# MySQL commits don't seem to ever fail, the latest update winning.
# makes you wonder why they have transactions...
self.sql("START TRANSACTION")
def sql_close(self):
- logging.getLogger('hyperdb').info('close')
+ self.log_info('close')
try:
self.conn.close()
except MySQLdb.ProgrammingError, message: