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
746f2a4b
Kaydet (Commit)
746f2a4b
authored
Tem 31, 2014
tarafından
Shai Berger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23061: Avoided setting a limit on a query for get with select_for_update on Oracle
Thanks Michael Miller for reporting the issue.
üst
6d256ae2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
__init__.py
django/db/backends/__init__.py
+3
-0
base.py
django/db/backends/oracle/base.py
+2
-0
query.py
django/db/models/query.py
+3
-1
tests.py
tests/select_for_update/tests.py
+6
-0
No files found.
django/db/backends/__init__.py
Dosyayı görüntüle @
746f2a4b
...
...
@@ -666,6 +666,9 @@ class BaseDatabaseFeatures(object):
uppercases_column_names
=
False
# Does the backend support "select for update" queries with limit (and offset)?
supports_select_for_update_with_limit
=
True
def
__init__
(
self
,
connection
):
self
.
connection
=
connection
...
...
django/db/backends/oracle/base.py
Dosyayı görüntüle @
746f2a4b
...
...
@@ -121,6 +121,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
closed_cursor_error_class
=
InterfaceError
bare_select_suffix
=
" FROM DUAL"
uppercases_column_names
=
True
# select for update with limit can be achieved on Oracle, but not with the current backend.
supports_select_for_update_with_limit
=
False
class
DatabaseOperations
(
BaseDatabaseOperations
):
...
...
django/db/models/query.py
Dosyayı görüntüle @
746f2a4b
...
...
@@ -357,7 +357,9 @@ class QuerySet(object):
clone
=
self
.
filter
(
*
args
,
**
kwargs
)
if
self
.
query
.
can_filter
():
clone
=
clone
.
order_by
()
clone
=
clone
[:
MAX_GET_RESULTS
+
1
]
if
(
not
clone
.
query
.
select_for_update
or
connections
[
self
.
db
]
.
features
.
supports_select_for_update_with_limit
):
clone
=
clone
[:
MAX_GET_RESULTS
+
1
]
num
=
len
(
clone
)
if
num
==
1
:
return
clone
.
_result_cache
[
0
]
...
...
tests/select_for_update/tests.py
Dosyayı görüntüle @
746f2a4b
...
...
@@ -265,3 +265,9 @@ class SelectForUpdateTests(TransactionTestCase):
self
.
assertEqual
(
router
.
db_for_write
(
Person
),
query
.
db
)
finally
:
router
.
routers
=
old_routers
@skipUnlessDBFeature
(
'has_select_for_update'
)
def
test_select_for_update_with_get
(
self
):
with
transaction
.
atomic
():
person
=
Person
.
objects
.
select_for_update
()
.
get
(
name
=
'Reinhardt'
)
self
.
assertEqual
(
person
.
name
,
'Reinhardt'
)
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