Ticket #9405: django-db-operations.diff

File django-db-operations.diff, 5.2 KB (added by Joey Wilhelm, 16 years ago)
  • db/backends/dummy/base.py

     
    4545        super(DatabaseWrapper, self).__init__(*args, **kwargs)
    4646
    4747        self.features = BaseDatabaseFeatures()
    48         self.ops = DatabaseOperations()
     48        self.ops = DatabaseOperations(self)
    4949        self.client = DatabaseClient()
    5050        self.creation = BaseDatabaseCreation(self)
    5151        self.introspection = DatabaseIntrospection(self)
  • db/backends/mysql/base.py

     
    223223        self.server_version = None
    224224
    225225        self.features = DatabaseFeatures()
    226         self.ops = DatabaseOperations()
     226        self.ops = DatabaseOperations(self)
    227227        self.client = DatabaseClient()
    228228        self.creation = DatabaseCreation(self)
    229229        self.introspection = DatabaseIntrospection(self)
  • db/backends/oracle/base.py

     
    137137    def regex_lookup(self, lookup_type):
    138138        # If regex_lookup is called before it's been initialized, then create
    139139        # a cursor to initialize it and recur.
    140         from django.db import connection
    141         connection.cursor()
     140        self.connection.cursor()
    142141        return connection.ops.regex_lookup(lookup_type)
    143142
    144143    def sql_flush(self, style, tables, sequences):
     
    231230        super(DatabaseWrapper, self).__init__(*args, **kwargs)
    232231
    233232        self.features = DatabaseFeatures()
    234         self.ops = DatabaseOperations()
     233        self.ops = DatabaseOperations(self)
    235234        self.client = DatabaseClient()
    236235        self.creation = DatabaseCreation(self)
    237236        self.introspection = DatabaseIntrospection(self)
  • db/backends/postgresql/base.py

     
    8989        super(DatabaseWrapper, self).__init__(*args, **kwargs)
    9090
    9191        self.features = DatabaseFeatures()
    92         self.ops = DatabaseOperations()
     92        self.ops = DatabaseOperations(self)
    9393        self.client = DatabaseClient()
    9494        self.creation = DatabaseCreation(self)
    9595        self.introspection = DatabaseIntrospection(self)
  • db/backends/postgresql/operations.py

     
    88# used by both the 'postgresql' and 'postgresql_psycopg2' backends.
    99
    1010class DatabaseOperations(BaseDatabaseOperations):
    11     def __init__(self):
     11    def __init__(self, *args):
    1212        self._postgres_version = None
     13        return super(DatabaseOperations, self).__init__(*args)
    1314
    1415    def _get_postgres_version(self):
    1516        if self._postgres_version is None:
    16             from django.db import connection
    17             cursor = connection.cursor()
     17            cursor = self.connection.cursor()
    1818            cursor.execute("SELECT version()")
    1919            version_string = cursor.fetchone()[0]
    2020            m = server_version_re.match(version_string)
  • db/backends/postgresql_psycopg2/base.py

     
    5959        super(DatabaseWrapper, self).__init__(*args, **kwargs)
    6060       
    6161        self.features = DatabaseFeatures()
    62         self.ops = DatabaseOperations()
     62        self.ops = DatabaseOperations(self)
    6363        self.client = DatabaseClient()
    6464        self.creation = DatabaseCreation(self)
    6565        self.introspection = DatabaseIntrospection(self)
  • db/backends/sqlite3/base.py

     
    126126        super(DatabaseWrapper, self).__init__(*args, **kwargs)
    127127       
    128128        self.features = DatabaseFeatures()
    129         self.ops = DatabaseOperations()
     129        self.ops = DatabaseOperations(self)
    130130        self.client = DatabaseClient()
    131131        self.creation = DatabaseCreation(self)
    132132        self.introspection = DatabaseIntrospection(self)
  • db/backends/__init__.py

     
    8181    a backend performs ordering or calculates the ID of a recently-inserted
    8282    row.
    8383    """
     84    def __init__(self, connection):
     85        self.connection = connection
     86
    8487    def autoinc_sql(self, table, column):
    8588        """
    8689        Returns any SQL needed to support auto-incrementing primary keys, or
Back to Top