Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
2a6b4e65
Kaydet (Commit)
2a6b4e65
authored
Nis 11, 2017
tarafından
Ran Benita
Kaydeden (comit)
Tim Graham
Nis 11, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Updated docs after changing select_for_update() to raise NotSupportedError.
Follow up to
054a44d6
.
üst
5dbf1c4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
databases.txt
docs/ref/databases.txt
+2
-1
querysets.txt
docs/ref/models/querysets.txt
+2
-2
tests.py
tests/select_for_update/tests.py
+4
-4
No files found.
docs/ref/databases.txt
Dosyayı görüntüle @
2a6b4e65
...
...
@@ -569,7 +569,8 @@ Row locking with ``QuerySet.select_for_update()``
MySQL does not support the ``NOWAIT`` and ``SKIP LOCKED`` options to the
``SELECT ... FOR UPDATE`` statement. If ``select_for_update()`` is used with
``nowait=True`` or ``skip_locked=True`` then a ``DatabaseError`` will be raised.
``nowait=True`` or ``skip_locked=True``, then a
:exc:`~django.db.NotSupportedError` is raised.
Automatic typecasting can cause unexpected results
--------------------------------------------------
...
...
docs/ref/models/querysets.txt
Dosyayı görüntüle @
2a6b4e65
...
...
@@ -1640,8 +1640,8 @@ backends support ``select_for_update()``. However, MySQL doesn't support the
``nowait`` and ``skip_locked`` arguments.
Passing ``nowait=True`` or ``skip_locked=True`` to ``select_for_update()``
using database backends that do not support these options, such as MySQL,
will
cause a :exc:`~django.db.DatabaseError` to be raised
. This prevents code from
using database backends that do not support these options, such as MySQL,
raises a :exc:`~django.db.NotSupportedError`
. This prevents code from
unexpectedly blocking.
Evaluating a queryset with ``select_for_update()`` in autocommit mode on
...
...
tests/select_for_update/tests.py
Dosyayı görüntüle @
2a6b4e65
...
...
@@ -134,7 +134,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature
(
'has_select_for_update'
)
def
test_unsupported_nowait_raises_error
(
self
):
"""
Database
Error is raised if a SELECT...FOR UPDATE NOWAIT is run on
NotSupported
Error is raised if a SELECT...FOR UPDATE NOWAIT is run on
a database backend that supports FOR UPDATE but not NOWAIT.
"""
with
self
.
assertRaisesMessage
(
NotSupportedError
,
'NOWAIT is not supported on this database backend.'
):
...
...
@@ -145,8 +145,8 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature
(
'has_select_for_update'
)
def
test_unsupported_skip_locked_raises_error
(
self
):
"""
DatabaseError is raised if a SELECT...FOR UPDATE SKIP LOCKED is run o
n
a database backend that supports FOR UPDATE but not SKIP LOCKED.
NotSupportedError is raised if a SELECT...FOR UPDATE SKIP LOCKED is ru
n
on
a database backend that supports FOR UPDATE but not SKIP LOCKED.
"""
with
self
.
assertRaisesMessage
(
NotSupportedError
,
'SKIP LOCKED is not supported on this database backend.'
):
with
transaction
.
atomic
():
...
...
@@ -189,7 +189,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipIfDBFeature
(
'supports_select_for_update_with_limit'
)
def
test_unsupported_select_for_update_with_limit
(
self
):
msg
=
'LIMIT/OFFSET not supported with select_for_update on this database backend.'
msg
=
'LIMIT/OFFSET
is
not supported with select_for_update on this database backend.'
with
self
.
assertRaisesMessage
(
NotSupportedError
,
msg
):
with
transaction
.
atomic
():
list
(
Person
.
objects
.
all
()
.
order_by
(
'pk'
)
.
select_for_update
()[
1
:
2
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment