Django

Code

Changeset 5435

Show
Ignore:
Timestamp:
06/07/07 13:12:12 (1 year ago)
Author:
jacob
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/model-api.txt

    r5364 r5435  
    18611861        return row 
    18621862 
    1863 ``connection`` and ``cursor`` simply use the standard `Python DB-API`_. If 
    1864 you're not familiar with the Python DB-API, note that the SQL statement in 
    1865 ``cursor.execute()`` uses placeholders, ``"%s"``, rather than adding parameters 
    1866 directly within the SQL. If you use this technique, the underlying database 
    1867 library will automatically add quotes and escaping to your parameter(s) as 
    1868 necessary. (Also note that Django expects the ``"%s"`` placeholder, *not* the 
    1869 ``"?"`` placeholder, which is used by the SQLite Python bindings. This is for 
    1870 the sake of consistency and sanity.) 
     1863``connection`` and ``cursor`` mostly implement the standard `Python DB-API`_ 
     1864(except when it comes to `transaction handling`_). If you're not familiar with 
     1865the Python DB-API, note that the SQL statement in ``cursor.execute()`` uses 
     1866placeholders, ``"%s"``, rather than adding parameters directly within the SQL. 
     1867If you use this technique, the underlying database library will automatically 
     1868add quotes and escaping to your parameter(s) as necessary. (Also note that 
     1869Django expects the ``"%s"`` placeholder, *not* the ``"?"`` placeholder, which is 
     1870used by the SQLite Python bindings. This is for the sake of consistency and 
     1871sanity.) 
    18711872 
    18721873A final note: If all you want to do is a custom ``WHERE`` clause, you can just 
     
    18761877.. _Python DB-API: http://www.python.org/peps/pep-0249.html 
    18771878.. _Other lookup options: ../db-api/#extra-params-select-where-tables 
     1879.. _transaction handling: ../transactions/ 
    18781880 
    18791881Overriding default model methods