Merge pull request #2333 from davesque/sql-doc-fixes

Capitalize SQL keywords
This commit is contained in:
Alex Gaynor 2014-02-20 10:38:01 -08:00
commit 476abc7ea7
1 changed files with 2 additions and 2 deletions

View File

@ -86,7 +86,7 @@ had ``Person`` data in it, you could easily map it into ``Person`` instances::
>>> Person.objects.raw('''SELECT first AS first_name, >>> Person.objects.raw('''SELECT first AS first_name,
... last AS last_name, ... last AS last_name,
... bd AS birth_date, ... bd AS birth_date,
... pk as id, ... pk AS id,
... FROM some_other_table''') ... FROM some_other_table''')
As long as the names match, the model instances will be created correctly. As long as the names match, the model instances will be created correctly.
@ -247,7 +247,7 @@ Note that if you want to include literal percent signs in the query, you have to
double them in the case you are passing parameters:: double them in the case you are passing parameters::
cursor.execute("SELECT foo FROM bar WHERE baz = '30%'") cursor.execute("SELECT foo FROM bar WHERE baz = '30%'")
cursor.execute("SELECT foo FROM bar WHERE baz = '30%%' and id = %s", [self.id]) cursor.execute("SELECT foo FROM bar WHERE baz = '30%%' AND id = %s", [self.id])
If you are using :doc:`more than one database </topics/db/multi-db>`, you can If you are using :doc:`more than one database </topics/db/multi-db>`, you can
use ``django.db.connections`` to obtain the connection (and cursor) for a use ``django.db.connections`` to obtain the connection (and cursor) for a