def __init__(self, *args, **kwargs): super(DatabaseWrapper, self).__init__(*args, **kwargs) self.features = BaseDatabaseFeatures(self) self.ops = DatabaseOperations(self) self.client = DatabaseClient(self) self.creation = DatabaseCreation(self) self.introspection = DatabaseIntrospection(self) self.validation = BaseDatabaseValidation(self)
def __init__(self, settings_dict, alias=None, *args, **kwargs): super(DatabaseWrapper, self).__init__(settings_dict, alias=alias, *args, **kwargs) if settings_dict['HOST']: kwargs['host'] = settings_dict['HOST'] if settings_dict['PORT']: kwargs['port'] = int(settings_dict['PORT']) if 'OPTIONS' in settings_dict: kwargs.update(settings_dict['OPTIONS']) self.connection = ConnectionWrapper(**kwargs) try: self.features = DatabaseFeatures(self.connection) except TypeError: # Django < 1.3 self.features = BaseDatabaseFeatures() try: self.ops = DatabaseOperations(self.connection) except TypeError: # Django < 1.4 self.ops = DatabaseOperations() self.client = DatabaseClient(self) self.creation = DatabaseCreation(self) self.introspection = DatabaseIntrospection(self) try: self.validation = BaseDatabaseValidation(self) except TypeError: # Django < 1.2 self.validation = BaseDatabaseValidation() settings_dict['SUPPORTS_TRANSACTIONS'] = False self.settings_dict = settings_dict self.alias = alias and alias or settings_dict['DATABASE_NAME'] # transaction related attributes self.transaction_state = None
class DatabaseConnection: vendor = "this_vendor_will_never_exist" features = BaseDatabaseFeatures(connection=None)
class DatabaseConnection: vendor = "postgresql" features = BaseDatabaseFeatures(connection=None)