Normalized "an SQL" spelling.
This commit is contained in:
parent
e00d77c483
commit
575a9a791e
|
@ -264,7 +264,7 @@ class BaseDatabaseOperations(object):
|
||||||
|
|
||||||
def prepare_sql_script(self, sql):
|
def prepare_sql_script(self, sql):
|
||||||
"""
|
"""
|
||||||
Takes a SQL script that may contain multiple lines and returns a list
|
Takes an SQL script that may contain multiple lines and returns a list
|
||||||
of statements to feed to successive cursor.execute() calls.
|
of statements to feed to successive cursor.execute() calls.
|
||||||
|
|
||||||
Since few databases are able to process raw SQL scripts in a single
|
Since few databases are able to process raw SQL scripts in a single
|
||||||
|
@ -376,7 +376,7 @@ class BaseDatabaseOperations(object):
|
||||||
to tables with foreign keys pointing the tables being truncated.
|
to tables with foreign keys pointing the tables being truncated.
|
||||||
PostgreSQL requires a cascade even if these tables are empty.
|
PostgreSQL requires a cascade even if these tables are empty.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError('subclasses of BaseDatabaseOperations must provide a sql_flush() method')
|
raise NotImplementedError('subclasses of BaseDatabaseOperations must provide an sql_flush() method')
|
||||||
|
|
||||||
def sequence_reset_by_name_sql(self, style, sequences):
|
def sequence_reset_by_name_sql(self, style, sequences):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -472,7 +472,7 @@ class F(Combinable):
|
||||||
|
|
||||||
class Func(Expression):
|
class Func(Expression):
|
||||||
"""
|
"""
|
||||||
A SQL function call.
|
An SQL function call.
|
||||||
"""
|
"""
|
||||||
function = None
|
function = None
|
||||||
template = '%(function)s(%(expressions)s)'
|
template = '%(function)s(%(expressions)s)'
|
||||||
|
|
|
@ -239,7 +239,7 @@ class ForwardManyToOneDescriptor(object):
|
||||||
for lh_field, rh_field in self.field.related_fields:
|
for lh_field, rh_field in self.field.related_fields:
|
||||||
setattr(instance, lh_field.attname, getattr(value, rh_field.attname))
|
setattr(instance, lh_field.attname, getattr(value, rh_field.attname))
|
||||||
|
|
||||||
# Set the related instance cache used by __get__ to avoid a SQL query
|
# Set the related instance cache used by __get__ to avoid an SQL query
|
||||||
# when accessing the attribute we just set.
|
# when accessing the attribute we just set.
|
||||||
setattr(instance, self.cache_name, value)
|
setattr(instance, self.cache_name, value)
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ class ReverseOneToOneDescriptor(object):
|
||||||
for index, field in enumerate(self.related.field.local_related_fields):
|
for index, field in enumerate(self.related.field.local_related_fields):
|
||||||
setattr(value, field.attname, related_pk[index])
|
setattr(value, field.attname, related_pk[index])
|
||||||
|
|
||||||
# Set the related instance cache used by __get__ to avoid a SQL query
|
# Set the related instance cache used by __get__ to avoid an SQL query
|
||||||
# when accessing the attribute we just set.
|
# when accessing the attribute we just set.
|
||||||
setattr(instance, self.cache_name, value)
|
setattr(instance, self.cache_name, value)
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ We then need to define the ``as_sql`` method. This takes a ``SQLCompiler``
|
||||||
object, called ``compiler``, and the active database connection.
|
object, called ``compiler``, and the active database connection.
|
||||||
``SQLCompiler`` objects are not documented, but the only thing we need to know
|
``SQLCompiler`` objects are not documented, but the only thing we need to know
|
||||||
about them is that they have a ``compile()`` method which returns a tuple
|
about them is that they have a ``compile()`` method which returns a tuple
|
||||||
containing a SQL string, and the parameters to be interpolated into that
|
containing an SQL string, and the parameters to be interpolated into that
|
||||||
string. In most cases, you don't need to use it directly and can pass it on to
|
string. In most cases, you don't need to use it directly and can pass it on to
|
||||||
``process_lhs()`` and ``process_rhs()``.
|
``process_lhs()`` and ``process_rhs()``.
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ example, ``process_lhs`` returns ``('"author"."name"', [])`` and
|
||||||
parameters for the left hand side, but this would depend on the object we have,
|
parameters for the left hand side, but this would depend on the object we have,
|
||||||
so we still need to include them in the parameters we return.
|
so we still need to include them in the parameters we return.
|
||||||
|
|
||||||
Finally we combine the parts into a SQL expression with ``<>``, and supply all
|
Finally we combine the parts into an SQL expression with ``<>``, and supply all
|
||||||
the parameters for the query. We then return a tuple containing the generated
|
the parameters for the query. We then return a tuple containing the generated
|
||||||
SQL string and the parameters.
|
SQL string and the parameters.
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ makes it possible to refer to model field values and perform database
|
||||||
operations using them without actually having to pull them out of the database
|
operations using them without actually having to pull them out of the database
|
||||||
into Python memory.
|
into Python memory.
|
||||||
|
|
||||||
Instead, Django uses the ``F()`` object to generate a SQL expression that
|
Instead, Django uses the ``F()`` object to generate an SQL expression that
|
||||||
describes the required operation at the database level.
|
describes the required operation at the database level.
|
||||||
|
|
||||||
This is easiest to understand through an example. Normally, one might do
|
This is easiest to understand through an example. Normally, one might do
|
||||||
|
|
|
@ -651,7 +651,7 @@ Tests
|
||||||
|
|
||||||
* Added test client support for file uploads with file-like objects.
|
* Added test client support for file uploads with file-like objects.
|
||||||
|
|
||||||
* A shared cache is now used when testing with a SQLite in-memory database when
|
* A shared cache is now used when testing with an SQLite in-memory database when
|
||||||
using Python 3.4+ and SQLite 3.7.13+. This allows sharing the database
|
using Python 3.4+ and SQLite 3.7.13+. This allows sharing the database
|
||||||
between threads.
|
between threads.
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ control the particular collation used by the test database. See the
|
||||||
:doc:`settings documentation </ref/settings>` for details of these
|
:doc:`settings documentation </ref/settings>` for details of these
|
||||||
and other advanced settings.
|
and other advanced settings.
|
||||||
|
|
||||||
If using a SQLite in-memory database with Python 3.4+ and SQLite 3.7.13+,
|
If using an SQLite in-memory database with Python 3.4+ and SQLite 3.7.13+,
|
||||||
`shared cache <https://www.sqlite.org/sharedcache.html>`_ will be enabled, so
|
`shared cache <https://www.sqlite.org/sharedcache.html>`_ will be enabled, so
|
||||||
you can write tests with ability to share the database between threads.
|
you can write tests with ability to share the database between threads.
|
||||||
|
|
||||||
|
|
|
@ -1572,7 +1572,7 @@ class SchemaTests(TransactionTestCase):
|
||||||
editor.create_model(Thing)
|
editor.create_model(Thing)
|
||||||
except OperationalError as e:
|
except OperationalError as e:
|
||||||
self.fail("Errors when applying initial migration for a model "
|
self.fail("Errors when applying initial migration for a model "
|
||||||
"with a table named after a SQL reserved word: %s" % e)
|
"with a table named after an SQL reserved word: %s" % e)
|
||||||
# Check that it's there
|
# Check that it's there
|
||||||
list(Thing.objects.all())
|
list(Thing.objects.all())
|
||||||
# Clean up that table
|
# Clean up that table
|
||||||
|
|
Loading…
Reference in New Issue