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
054a44d6
Kaydet (Commit)
054a44d6
authored
Nis 10, 2017
tarafından
Mariusz Felisiak
Kaydeden (comit)
Tim Graham
Nis 10, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used NotSupportedError instead of DatabaseError in SQLCompiler.as_sql().
üst
d825ac6d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
compiler.py
django/db/backends/oracle/compiler.py
+1
-1
compiler.py
django/db/models/sql/compiler.py
+5
-5
test_qs_combinators.py
tests/queries/test_qs_combinators.py
+3
-3
tests.py
tests/select_for_update/tests.py
+2
-2
No files found.
django/db/backends/oracle/compiler.py
Dosyayı görüntüle @
054a44d6
...
...
@@ -20,7 +20,7 @@ class SQLCompiler(compiler.SQLCompiler):
sql
,
params
=
super
()
.
as_sql
(
with_limits
=
False
,
with_col_aliases
=
with_col_aliases
)
elif
not
self
.
connection
.
features
.
supports_select_for_update_with_limit
and
self
.
query
.
select_for_update
:
raise
NotSupportedError
(
'LIMIT/OFFSET not supported with select_for_update on this '
'LIMIT/OFFSET
is
not supported with select_for_update on this '
'database backend.'
)
else
:
...
...
django/db/models/sql/compiler.py
Dosyayı görüntüle @
054a44d6
...
...
@@ -430,7 +430,7 @@ class SQLCompiler:
features
=
self
.
connection
.
features
if
combinator
:
if
not
getattr
(
features
,
'supports_select_{}'
.
format
(
combinator
)):
raise
DatabaseError
(
'{}
not supported on this database backend.'
.
format
(
combinator
))
raise
NotSupportedError
(
'{} is
not supported on this database backend.'
.
format
(
combinator
))
result
,
params
=
self
.
get_combinator_sql
(
combinator
,
self
.
query
.
combinator_all
)
else
:
result
=
[
'SELECT'
]
...
...
@@ -462,8 +462,8 @@ class SQLCompiler:
if
with_limits
and
not
self
.
connection
.
features
.
supports_select_for_update_with_limit
:
raise
NotSupportedError
(
'LIMIT/OFFSET
not supported with select_for_update
'
' on this database backend.'
'LIMIT/OFFSET
is not supported with
'
'
select_for_update
on this database backend.'
)
nowait
=
self
.
query
.
select_for_update_nowait
skip_locked
=
self
.
query
.
select_for_update_skip_locked
...
...
@@ -471,9 +471,9 @@ class SQLCompiler:
# doesn't support it, raise a DatabaseError to prevent a
# possible deadlock.
if
nowait
and
not
self
.
connection
.
features
.
has_select_for_update_nowait
:
raise
Database
Error
(
'NOWAIT is not supported on this database backend.'
)
raise
NotSupported
Error
(
'NOWAIT is not supported on this database backend.'
)
elif
skip_locked
and
not
self
.
connection
.
features
.
has_select_for_update_skip_locked
:
raise
Database
Error
(
'SKIP LOCKED is not supported on this database backend.'
)
raise
NotSupported
Error
(
'SKIP LOCKED is not supported on this database backend.'
)
for_update_part
=
self
.
connection
.
ops
.
for_update_sql
(
nowait
=
nowait
,
skip_locked
=
skip_locked
)
if
for_update_part
and
self
.
connection
.
features
.
for_update_after_from
:
...
...
tests/queries/test_qs_combinators.py
Dosyayı görüntüle @
054a44d6
from
django.db.models
import
F
,
IntegerField
,
Value
from
django.db.utils
import
DatabaseError
from
django.db.utils
import
DatabaseError
,
NotSupportedError
from
django.test
import
TestCase
,
skipIfDBFeature
,
skipUnlessDBFeature
from
.models
import
Number
,
ReservedName
...
...
@@ -73,8 +73,8 @@ class QuerySetSetOperationTests(TestCase):
def
test_unsupported_intersection_raises_db_error
(
self
):
qs1
=
Number
.
objects
.
all
()
qs2
=
Number
.
objects
.
all
()
msg
=
'intersection not supported on this database backend'
with
self
.
assertRaisesMessage
(
Database
Error
,
msg
):
msg
=
'intersection
is
not supported on this database backend'
with
self
.
assertRaisesMessage
(
NotSupported
Error
,
msg
):
list
(
qs1
.
intersection
(
qs2
))
def
test_combining_multiple_models
(
self
):
...
...
tests/select_for_update/tests.py
Dosyayı görüntüle @
054a44d6
...
...
@@ -137,7 +137,7 @@ class SelectForUpdateTests(TransactionTestCase):
DatabaseError is raised if a SELECT...FOR UPDATE NOWAIT is run on
a database backend that supports FOR UPDATE but not NOWAIT.
"""
with
self
.
assertRaisesMessage
(
Database
Error
,
'NOWAIT is not supported on this database backend.'
):
with
self
.
assertRaisesMessage
(
NotSupported
Error
,
'NOWAIT is not supported on this database backend.'
):
with
transaction
.
atomic
():
Person
.
objects
.
select_for_update
(
nowait
=
True
)
.
get
()
...
...
@@ -148,7 +148,7 @@ class SelectForUpdateTests(TransactionTestCase):
DatabaseError is raised if a SELECT...FOR UPDATE SKIP LOCKED is run on
a database backend that supports FOR UPDATE but not SKIP LOCKED.
"""
with
self
.
assertRaisesMessage
(
Database
Error
,
'SKIP LOCKED is not supported on this database backend.'
):
with
self
.
assertRaisesMessage
(
NotSupported
Error
,
'SKIP LOCKED is not supported on this database backend.'
):
with
transaction
.
atomic
():
Person
.
objects
.
select_for_update
(
skip_locked
=
True
)
.
get
()
...
...
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