Code

Ticket #19442: 19442.diff

File 19442.diff, 2.5 KB (added by timo, 16 months ago)
Line 
1diff --git a/docs/topics/db/sql.txt b/docs/topics/db/sql.txt
2index 310dcb5..8c6b9f2 100644
3--- a/docs/topics/db/sql.txt
4+++ b/docs/topics/db/sql.txt
5@@ -210,8 +210,10 @@ default database transaction. To use the database connection, call
6 or ``cursor.fetchall()`` to return the resulting rows. After performing a data
7 changing operation, you should then call
8 ``transaction.commit_unless_managed()`` to ensure your changes are committed
9-to the database. If your query is purely a data retrieval operation, no commit
10-is required. For example::
11+to the database  (required only if you are using the default transaction
12+management, :func:`~django.db.transaction.autocommit`, since Django doesn't
13+know whether the raw SQL is a read or write). If your query is purely a data
14+retrieval operation, no commit is required. For example::
15 
16     def my_custom_sql():
17         from django.db import connection, transaction
18diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt
19index e3c2cad..2d3c4da 100644
20--- a/docs/topics/db/transactions.txt
21+++ b/docs/topics/db/transactions.txt
22@@ -196,14 +196,18 @@ managers, too.
23 Requirements for transaction handling
24 =====================================
25 
26-Django requires that every transaction that is opened is closed before
27-the completion of a request. If you are using :func:`autocommit` (the
28-default commit mode) or :func:`commit_on_success`, this will be done
29-for you automatically (with the exception of :ref:`executing custom SQL
30-<executing-custom-sql>`). However, if you are manually managing
31-transactions (using the :func:`commit_manually` decorator), you must
32-ensure that the transaction is either committed or rolled back before
33-a request is completed.
34+Django requires that every transaction that is opened be closed before
35+the completion of a request.
36+
37+If you are using :func:`autocommit` (the default commit mode) or
38+:func:`commit_on_success`, this will be done for you automatically in most
39+cases. The exception is if you are :ref:`executing custom SQL
40+<executing-custom-sql>` and using :func:`autocommit`, in which case you'll need
41+to explicitly commit any data changing queries.
42+
43+If you are manually managing transactions (using the :func:`commit_manually`
44+decorator), you must ensure that the transaction is either committed or rolled
45+back before a request is completed.
46 
47 This applies to all database operations, not just write operations. Even
48 if your transaction only reads from the database, the transaction must