#NEWLINE# def __init__( self , database_name ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . dbh = self . _MakeConnection ( database = database_name ) #NEWLINE# self . cursor = self . dbh . cursor ( ) #NEWLINE# self . cursor . connection . autocommit ( True ) #NEWLINE# self . cursor . execute ( 'SET NAMES binary' ) #NEWLINE# #UNINDENT# except MySQLdb . OperationalError as e : #NEWLINE# #INDENT# if ( 'Unknown database' in str ( e ) ) : #NEWLINE# #INDENT# dbh = self . _MakeConnection ( ) #NEWLINE# cursor = dbh . cursor ( ) #NEWLINE# cursor . connection . autocommit ( True ) #NEWLINE# cursor . execute ( ( 'Create database `%s`' % database_name ) ) #NEWLINE# cursor . close ( ) #NEWLINE# dbh . close ( ) #NEWLINE# self . dbh = self . _MakeConnection ( database = database_name ) #NEWLINE# self . cursor = self . dbh . cursor ( ) #NEWLINE# self . cursor . connection . autocommit ( True ) #NEWLINE# self . cursor . execute ( 'SET NAMES binary' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise