mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
parent
18dd184ef0
commit
0f4964535c
@ -158,7 +158,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|||||||
# between multiple threads. The safe-guarding will be handled at a
|
# between multiple threads. The safe-guarding will be handled at a
|
||||||
# higher level by the `BaseDatabaseWrapper.allow_thread_sharing`
|
# higher level by the `BaseDatabaseWrapper.allow_thread_sharing`
|
||||||
# property. This is necessary as the shareability is disabled by
|
# property. This is necessary as the shareability is disabled by
|
||||||
# default in pysqlite and it cannot be changed once a connection is
|
# default in sqlite3 and it cannot be changed once a connection is
|
||||||
# opened.
|
# opened.
|
||||||
if "check_same_thread" in kwargs and kwargs["check_same_thread"]:
|
if "check_same_thread" in kwargs and kwargs["check_same_thread"]:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
@ -357,7 +357,7 @@ FORMAT_QMARK_REGEX = _lazy_re_compile(r"(?<!%)%s")
|
|||||||
|
|
||||||
class SQLiteCursorWrapper(Database.Cursor):
|
class SQLiteCursorWrapper(Database.Cursor):
|
||||||
"""
|
"""
|
||||||
Django uses "format" style placeholders, but pysqlite2 uses "qmark" style.
|
Django uses "format" style placeholders, but sqlite3 uses "qmark" style.
|
||||||
This fixes it -- but note that if you want to use a literal "%s" in a query,
|
This fixes it -- but note that if you want to use a literal "%s" in a query,
|
||||||
you'll need to use "%%s".
|
you'll need to use "%%s".
|
||||||
"""
|
"""
|
||||||
|
@ -168,9 +168,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|||||||
|
|
||||||
def last_executed_query(self, cursor, sql, params):
|
def last_executed_query(self, cursor, sql, params):
|
||||||
# Python substitutes parameters in Modules/_sqlite/cursor.c with:
|
# Python substitutes parameters in Modules/_sqlite/cursor.c with:
|
||||||
# pysqlite_statement_bind_parameters(
|
# bind_parameters(state, self->statement, parameters);
|
||||||
# self->statement, parameters, allow_8bit_chars
|
|
||||||
# );
|
|
||||||
# Unfortunately there is no way to reach self->statement from Python,
|
# Unfortunately there is no way to reach self->statement from Python,
|
||||||
# so we quote and substitute parameters manually.
|
# so we quote and substitute parameters manually.
|
||||||
if params:
|
if params:
|
||||||
|
@ -900,8 +900,8 @@ object, use ``django.db.connections[DEFAULT_DB_ALIAS]`` instead.
|
|||||||
|
|
||||||
As part of this change, all underlying SQLite connections are now enabled for
|
As part of this change, all underlying SQLite connections are now enabled for
|
||||||
potential thread-sharing (by passing the ``check_same_thread=False`` attribute
|
potential thread-sharing (by passing the ``check_same_thread=False`` attribute
|
||||||
to pysqlite). ``DatabaseWrapper`` however preserves the previous behavior by
|
to ``pysqlite``). ``DatabaseWrapper`` however preserves the previous behavior
|
||||||
disabling thread-sharing by default, so this does not affect any existing
|
by disabling thread-sharing by default, so this does not affect any existing
|
||||||
code that purely relies on the ORM or on ``DatabaseWrapper.cursor()``.
|
code that purely relies on the ORM or on ``DatabaseWrapper.cursor()``.
|
||||||
|
|
||||||
Finally, while it's now possible to pass connections between threads, Django
|
Finally, while it's now possible to pass connections between threads, Django
|
||||||
|
@ -387,7 +387,6 @@ psycopg
|
|||||||
Punycode
|
Punycode
|
||||||
Puthraya
|
Puthraya
|
||||||
pyformat
|
pyformat
|
||||||
pysqlite
|
|
||||||
pythonic
|
pythonic
|
||||||
qs
|
qs
|
||||||
queryset
|
queryset
|
||||||
|
Loading…
Reference in New Issue
Block a user