3333'''
3434__docformat__ = 'restructuredtext'
3535
36- from roundup . backends . rdbms_common import *
36+ from roundup import date , hyperdb , password
3737from roundup .backends import rdbms_common
3838import MySQLdb
3939import os , shutil
@@ -109,7 +109,7 @@ def db_exists(config):
109109 return 1
110110
111111
112- class Database (Database ):
112+ class Database (rdbms_common . Database ):
113113 arg = '%s'
114114
115115 # used by some code to switch styles of query
@@ -151,7 +151,7 @@ def sql_open_connection(self):
151151 try :
152152 conn = MySQLdb .connect (** kwargs )
153153 except MySQLdb .OperationalError , message :
154- raise DatabaseError , message
154+ raise hyperdb . DatabaseError , message
155155 cursor = conn .cursor ()
156156 cursor .execute ("SET AUTOCOMMIT=0" )
157157 lvl = isolation_levels [self .config .RDBMS_ISOLATION_LEVEL ]
@@ -173,7 +173,7 @@ def open_connection(self):
173173 raise
174174 except MySQLdb .ProgrammingError , message :
175175 if message [0 ] != ER .NO_SUCH_TABLE :
176- raise DatabaseError , message
176+ raise hyperdb . DatabaseError , message
177177 self .init_dbschema ()
178178 self .sql ("CREATE TABLE `schema` (`schema` TEXT) ENGINE=%s" %
179179 self .mysql_backend )
@@ -295,16 +295,16 @@ def add_new_columns_v2(self):
295295 if first :
296296 cols .append ('_' + name )
297297 prop = properties [name ]
298- if isinstance (prop , Date ) and v is not None :
298+ if isinstance (prop , hyperdb . Date ) and v is not None :
299299 v = date .Date (v )
300- elif isinstance (prop , Interval ) and v is not None :
300+ elif isinstance (prop , hyperdb . Interval ) and v is not None :
301301 v = date .Interval (v )
302- elif isinstance (prop , Password ) and v is not None :
302+ elif isinstance (prop , hyperdb . Password ) and v is not None :
303303 v = password .Password (encrypted = v )
304- elif isinstance (prop , Integer ) and v is not None :
304+ elif isinstance (prop , hyperdb . Integer ) and v is not None :
305305 v = int (v )
306- elif (isinstance (prop , Boolean ) or
307- isinstance (prop , Number )) and v is not None :
306+ elif (isinstance (prop , hyperdb . Boolean ) or
307+ isinstance (prop , hyperdb . Number )) and v is not None :
308308 v = float (v )
309309
310310 # convert to new MySQL data type
@@ -316,7 +316,7 @@ def add_new_columns_v2(self):
316316 l .append (e )
317317
318318 # Intervals store the seconds value too
319- if isinstance (prop , Interval ):
319+ if isinstance (prop , hyperdb . Interval ):
320320 if first :
321321 cols .append ('__' + name + '_int__' )
322322 if v is not None :
@@ -420,7 +420,7 @@ def create_class_table_indexes(self, spec):
420420
421421 # create index for key property
422422 if spec .key :
423- if isinstance (spec .properties [spec .key ], String ):
423+ if isinstance (spec .properties [spec .key ], hyperdb . String ):
424424 idx = spec .key + '(255)'
425425 else :
426426 idx = spec .key
@@ -435,7 +435,7 @@ def create_class_table_indexes(self, spec):
435435 def add_class_key_required_unique_constraint (self , cn , key ):
436436 # mysql requires sizes on TEXT indexes
437437 prop = self .classes [cn ].getprops ()[key ]
438- if isinstance (prop , String ):
438+ if isinstance (prop , hyperdb . String ):
439439 sql = '''create unique index _%s_key_retired_idx
440440 on _%s(__retired__, _%s(255))''' % (cn , cn , key )
441441 else :
@@ -446,7 +446,7 @@ def add_class_key_required_unique_constraint(self, cn, key):
446446 def create_class_table_key_index (self , cn , key ):
447447 # mysql requires sizes on TEXT indexes
448448 prop = self .classes [cn ].getprops ()[key ]
449- if isinstance (prop , String ):
449+ if isinstance (prop , hyperdb . String ):
450450 sql = 'create index _%s_%s_idx on _%s(_%s(255))' % (cn , key , cn , key )
451451 else :
452452 sql = 'create index _%s_%s_idx on _%s(_%s)' % (cn , key , cn , key )
0 commit comments