Fixed #2705: added a select_for_update() clause to querysets.

A number of people worked on this patch over the years -- Hawkeye, Colin Grady,
KBS, sakyamuni, anih, jdemoor, and Issak Kelly. Thanks to them all, and
apologies if I missed anyone.

Special thanks to Dan Fairs for picking it up again at the end and seeing this
through to commit.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2011-04-20 20:42:07 +00:00
parent 99c1794427
commit 8f0f73c7b8
14 changed files with 375 additions and 0 deletions

View file

@ -359,6 +359,13 @@ store a timezone-aware ``time`` or ``datetime`` to a
:class:`~django.db.models.TimeField` or :class:`~django.db.models.DateTimeField`
respectively, a ``ValueError`` is raised rather than truncating data.
Row locking with ``QuerySet.select_for_update()``
-------------------------------------------------
MySQL does not support the ``NOWAIT`` option to the ``SELECT ... FOR UPDATE``
statement. If ``select_for_update()`` is used with ``nowait=True`` then a
``DatabaseError`` will be raised.
.. _sqlite-notes:
SQLite notes
@ -493,6 +500,12 @@ If you're getting this error, you can solve it by:
This will simply make SQLite wait a bit longer before throwing "database
is locked" errors; it won't really do anything to solve them.
``QuerySet.select_for_update()`` not supported
----------------------------------------------
SQLite does not support the ``SELECT ... FOR UPDATE`` syntax. Calling it will
have no effect.
.. _oracle-notes:
Oracle notes