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
e17fa9e8
Kaydet (Commit)
e17fa9e8
authored
Mar 24, 2013
tarafından
Anssi Kääriäinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #20091 -- Oracle null promotion for empty strings
üst
a4b8a4b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
query.py
django/db/models/sql/query.py
+8
-0
tests.py
tests/queries/tests.py
+8
-1
No files found.
django/db/models/sql/query.py
Dosyayı görüntüle @
e17fa9e8
...
...
@@ -1078,6 +1078,14 @@ class Query(object):
elif
isinstance
(
value
,
ExpressionNode
):
# If value is a query expression, evaluate it
value
=
SQLEvaluator
(
value
,
self
,
reuse
=
can_reuse
)
# For Oracle '' is equivalent to null. The check needs to be done
# at this stage because join promotion can't be done at compiler
# stage. Using DEFAULT_DB_ALIAS isn't nice, but it is the best we
# can do here. Similar thing is done in is_nullable(), too.
if
(
connections
[
DEFAULT_DB_ALIAS
]
.
features
.
interprets_empty_strings_as_nulls
and
lookup_type
==
'exact'
and
value
==
''
):
value
=
True
lookup_type
=
'isnull'
for
alias
,
aggregate
in
self
.
aggregates
.
items
():
if
alias
in
(
parts
[
0
],
LOOKUP_SEP
.
join
(
parts
)):
...
...
tests/queries/tests.py
Dosyayı görüntüle @
e17fa9e8
...
...
@@ -1785,7 +1785,6 @@ class Queries6Tests(TestCase):
# Nested queries are possible (although should be used with care, since
# they have performance problems on backends like MySQL.
self
.
assertQuerysetEqual
(
Annotation
.
objects
.
filter
(
notes__in
=
Note
.
objects
.
filter
(
note
=
"n1"
)),
[
'<Annotation: a1>'
]
...
...
@@ -2824,3 +2823,11 @@ class Ticket20101Tests(TestCase):
self
.
assertTrue
(
n
in
qs1
)
self
.
assertFalse
(
n
in
qs2
)
self
.
assertTrue
(
n
in
(
qs1
|
qs2
))
class
EmptyStringPromotionTests
(
TestCase
):
def
test_empty_string_promotion
(
self
):
qs
=
RelatedObject
.
objects
.
filter
(
single__name
=
''
)
if
connection
.
features
.
interprets_empty_strings_as_nulls
:
self
.
assertIn
(
'LEFT OUTER JOIN'
,
str
(
qs
.
query
))
else
:
self
.
assertNotIn
(
'LEFT OUTER JOIN'
,
str
(
qs
.
query
))
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