Ticket #19442: 19442.diff

File 19442.diff, 2.5 KB (added by Tim Graham, 12 years ago)
  • docs/topics/db/sql.txt

    diff --git a/docs/topics/db/sql.txt b/docs/topics/db/sql.txt
    index 310dcb5..8c6b9f2 100644
    a b default database transaction. To use the database connection, call  
    210210or ``cursor.fetchall()`` to return the resulting rows. After performing a data
    211211changing operation, you should then call
    212212``transaction.commit_unless_managed()`` to ensure your changes are committed
    213 to the database. If your query is purely a data retrieval operation, no commit
    214 is required. For example::
     213to the database  (required only if you are using the default transaction
     214management, :func:`~django.db.transaction.autocommit`, since Django doesn't
     215know whether the raw SQL is a read or write). If your query is purely a data
     216retrieval operation, no commit is required. For example::
    215217
    216218    def my_custom_sql():
    217219        from django.db import connection, transaction
  • docs/topics/db/transactions.txt

    diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt
    index e3c2cad..2d3c4da 100644
    a b managers, too.  
    196196Requirements for transaction handling
    197197=====================================
    198198
    199 Django requires that every transaction that is opened is closed before
    200 the completion of a request. If you are using :func:`autocommit` (the
    201 default commit mode) or :func:`commit_on_success`, this will be done
    202 for you automatically (with the exception of :ref:`executing custom SQL
    203 <executing-custom-sql>`). However, if you are manually managing
    204 transactions (using the :func:`commit_manually` decorator), you must
    205 ensure that the transaction is either committed or rolled back before
    206 a request is completed.
     199Django requires that every transaction that is opened be closed before
     200the completion of a request.
     201
     202If you are using :func:`autocommit` (the default commit mode) or
     203:func:`commit_on_success`, this will be done for you automatically in most
     204cases. The exception is if you are :ref:`executing custom SQL
     205<executing-custom-sql>` and using :func:`autocommit`, in which case you'll need
     206to explicitly commit any data changing queries.
     207
     208If you are manually managing transactions (using the :func:`commit_manually`
     209decorator), you must ensure that the transaction is either committed or rolled
     210back before a request is completed.
    207211
    208212This applies to all database operations, not just write operations. Even
    209213if your transaction only reads from the database, the transaction must
Back to Top