diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-02-18 17:12:42 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-02-18 17:19:09 +0100 |
| commit | 29628e0b6e5b1c6324e0c06cc56a49a5aa0747e0 (patch) | |
| tree | fa564b4643556727c7086f92ba4ab9d26baca8b8 /django/db/backends/oracle/base.py | |
| parent | 64d0f89ab1dc6ef8a84814f567050fc063d67de2 (diff) | |
| download | django-29628e0b6e5b1c6324e0c06cc56a49a5aa0747e0.tar.gz | |
Factored out common code in database backends.
Diffstat (limited to 'django/db/backends/oracle/base.py')
| -rw-r--r-- | django/db/backends/oracle/base.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 7bcfb46798..e329ef3191 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -48,7 +48,6 @@ except ImportError as e: from django.conf import settings from django.db import utils from django.db.backends import * -from django.db.backends.signals import connection_created from django.db.backends.oracle.client import DatabaseClient from django.db.backends.oracle.creation import DatabaseCreation from django.db.backends.oracle.introspection import DatabaseIntrospection @@ -521,9 +520,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE') self.cursor().execute('SET CONSTRAINTS ALL DEFERRED') - def _valid_connection(self): - return self.connection is not None - def _connect_string(self): settings_dict = self.settings_dict if not settings_dict['HOST'].strip(): @@ -537,8 +533,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): return "%s/%s@%s" % (settings_dict['USER'], settings_dict['PASSWORD'], dsn) - def create_cursor(self, conn): - return FormatStylePlaceholderCursor(conn) + def create_cursor(self): + return FormatStylePlaceholderCursor(self.connection) def get_connection_params(self): conn_params = self.settings_dict['OPTIONS'].copy() @@ -551,7 +547,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): return Database.connect(conn_string, **conn_params) def init_connection_state(self): - cursor = self.create_cursor(self.connection) + cursor = self.create_cursor() # Set the territory first. The territory overrides NLS_DATE_FORMAT # and NLS_TIMESTAMP_FORMAT to the territory default. When all of # these are set in single statement it isn't clear what is supposed @@ -572,7 +568,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): # This check is performed only once per DatabaseWrapper # instance per thread, since subsequent connections will use # the same settings. - cursor = self.create_cursor(self.connection) + cursor = self.create_cursor() try: cursor.execute("SELECT 1 FROM DUAL WHERE DUMMY %s" % self._standard_operators['contains'], @@ -602,14 +598,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): # stmtcachesize is available only in 4.3.2 and up. pass - def _cursor(self): - if not self._valid_connection(): - conn_params = self.get_connection_params() - self.connection = self.get_new_connection(conn_params) - self.init_connection_state() - connection_created.send(sender=self.__class__, connection=self) - return self.create_cursor(self.connection) - # Oracle doesn't support savepoint commits. Ignore them. def _savepoint_commit(self, sid): pass |
