Fixed #3880: added a link to the transaction docs from the model API. Thanks, ken37@tds.net.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5435 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2007-06-07 18:12:12 +00:00
parent 6434de96b7
commit 908b72f76d
1 changed files with 10 additions and 8 deletions

View File

@ -1860,14 +1860,15 @@ rows. Example::
row = cursor.fetchone() row = cursor.fetchone()
return row return row
``connection`` and ``cursor`` simply use the standard `Python DB-API`_. If ``connection`` and ``cursor`` mostly implement the standard `Python DB-API`_
you're not familiar with the Python DB-API, note that the SQL statement in (except when it comes to `transaction handling`_). If you're not familiar with
``cursor.execute()`` uses placeholders, ``"%s"``, rather than adding parameters the Python DB-API, note that the SQL statement in ``cursor.execute()`` uses
directly within the SQL. If you use this technique, the underlying database placeholders, ``"%s"``, rather than adding parameters directly within the SQL.
library will automatically add quotes and escaping to your parameter(s) as If you use this technique, the underlying database library will automatically
necessary. (Also note that Django expects the ``"%s"`` placeholder, *not* the add quotes and escaping to your parameter(s) as necessary. (Also note that
``"?"`` placeholder, which is used by the SQLite Python bindings. This is for Django expects the ``"%s"`` placeholder, *not* the ``"?"`` placeholder, which is
the sake of consistency and sanity.) used by the SQLite Python bindings. This is for the sake of consistency and
sanity.)
A final note: If all you want to do is a custom ``WHERE`` clause, you can just A final note: If all you want to do is a custom ``WHERE`` clause, you can just
just the ``where``, ``tables`` and ``params`` arguments to the standard lookup just the ``where``, ``tables`` and ``params`` arguments to the standard lookup
@ -1875,6 +1876,7 @@ API. See `Other lookup options`_.
.. _Python DB-API: http://www.python.org/peps/pep-0249.html .. _Python DB-API: http://www.python.org/peps/pep-0249.html
.. _Other lookup options: ../db-api/#extra-params-select-where-tables .. _Other lookup options: ../db-api/#extra-params-select-where-tables
.. _transaction handling: ../transactions/
Overriding default model methods Overriding default model methods
-------------------------------- --------------------------------