Refs #16614 -- Called _prepare_cursor() on every created cursor.
This commit is contained in:
parent
1f10c3994c
commit
05bdf4f44d
|
@ -228,7 +228,7 @@ class BaseDatabaseWrapper(object):
|
||||||
def _cursor(self, name=None):
|
def _cursor(self, name=None):
|
||||||
self.ensure_connection()
|
self.ensure_connection()
|
||||||
with self.wrap_database_errors:
|
with self.wrap_database_errors:
|
||||||
return self.create_cursor(name)
|
return self._prepare_cursor(self.create_cursor(name))
|
||||||
|
|
||||||
def _commit(self):
|
def _commit(self):
|
||||||
if self.connection is not None:
|
if self.connection is not None:
|
||||||
|
@ -251,7 +251,7 @@ class BaseDatabaseWrapper(object):
|
||||||
"""
|
"""
|
||||||
Creates a cursor, opening a connection if necessary.
|
Creates a cursor, opening a connection if necessary.
|
||||||
"""
|
"""
|
||||||
return self._prepare_cursor(self._cursor())
|
return self._cursor()
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -223,14 +223,13 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
|
|
||||||
def chunked_cursor(self):
|
def chunked_cursor(self):
|
||||||
self._named_cursor_idx += 1
|
self._named_cursor_idx += 1
|
||||||
db_cursor = self._cursor(
|
return self._cursor(
|
||||||
name='_django_curs_%d_%d' % (
|
name='_django_curs_%d_%d' % (
|
||||||
# Avoid reusing name in other threads
|
# Avoid reusing name in other threads
|
||||||
threading.current_thread().ident,
|
threading.current_thread().ident,
|
||||||
self._named_cursor_idx,
|
self._named_cursor_idx,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return self._prepare_cursor(db_cursor)
|
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
with self.wrap_database_errors:
|
with self.wrap_database_errors:
|
||||||
|
|
Loading…
Reference in New Issue