Ticket #19442: 19442.diff
File 19442.diff, 2.5 KB (added by , 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 210 210 or ``cursor.fetchall()`` to return the resulting rows. After performing a data 211 211 changing operation, you should then call 212 212 ``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:: 213 to the database (required only if you are using the default transaction 214 management, :func:`~django.db.transaction.autocommit`, since Django doesn't 215 know whether the raw SQL is a read or write). If your query is purely a data 216 retrieval operation, no commit is required. For example:: 215 217 216 218 def my_custom_sql(): 217 219 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. 196 196 Requirements for transaction handling 197 197 ===================================== 198 198 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. 199 Django requires that every transaction that is opened be closed before 200 the completion of a request. 201 202 If you are using :func:`autocommit` (the default commit mode) or 203 :func:`commit_on_success`, this will be done for you automatically in most 204 cases. The exception is if you are :ref:`executing custom SQL 205 <executing-custom-sql>` and using :func:`autocommit`, in which case you'll need 206 to explicitly commit any data changing queries. 207 208 If you are manually managing transactions (using the :func:`commit_manually` 209 decorator), you must ensure that the transaction is either committed or rolled 210 back before a request is completed. 207 211 208 212 This applies to all database operations, not just write operations. Even 209 213 if your transaction only reads from the database, the transaction must