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
a9f17115
Kaydet (Commit)
a9f17115
authored
Ock 19, 2014
tarafından
Anssi Kääriäinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed Oracle in lookup when more than 1000 params
Refs #21821.
üst
457c16d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
lookups.py
django/db/models/lookups.py
+34
-2
No files found.
django/db/models/lookups.py
Dosyayı görüntüle @
a9f17115
from
copy
import
copy
from
itertools
import
repeat
import
inspect
from
django.conf
import
settings
...
...
@@ -77,8 +78,8 @@ class Lookup(RegisterLookupMixin):
lhs
=
lhs
or
self
.
lhs
return
qn
.
compile
(
lhs
)
def
process_rhs
(
self
,
qn
,
connection
,
rhs
=
None
):
value
=
rhs
or
self
.
rhs
def
process_rhs
(
self
,
qn
,
connection
):
value
=
self
.
rhs
# Due to historical reasons there are a couple of different
# ways to produce sql here. get_compiler is likely a Query
# instance, _as_sql QuerySet and as_sql just something with
...
...
@@ -95,6 +96,12 @@ class Lookup(RegisterLookupMixin):
else
:
return
self
.
get_db_prep_lookup
(
value
,
connection
)
def
rhs_is_direct_value
(
self
):
return
not
(
hasattr
(
self
.
rhs
,
'as_sql'
)
or
hasattr
(
self
.
rhs
,
'_as_sql'
)
or
hasattr
(
self
.
rhs
,
'get_compiler'
))
def
relabeled_clone
(
self
,
relabels
):
new
=
copy
(
self
)
new
.
lhs
=
new
.
lhs
.
relabeled_clone
(
relabels
)
...
...
@@ -186,6 +193,31 @@ class In(BuiltinLookup):
def
get_rhs_op
(
self
,
connection
,
rhs
):
return
'IN
%
s'
%
rhs
def
as_sql
(
self
,
qn
,
connection
):
max_in_list_size
=
connection
.
ops
.
max_in_list_size
()
if
self
.
rhs_is_direct_value
()
and
(
max_in_list_size
and
len
(
self
.
rhs
)
>
max_in_list_size
):
rhs
,
rhs_params
=
self
.
process_rhs
(
qn
,
connection
)
lhs
,
lhs_params
=
self
.
process_lhs
(
qn
,
connection
)
in_clause_elements
=
[
'('
]
params
=
[]
for
offset
in
xrange
(
0
,
len
(
rhs_params
),
max_in_list_size
):
if
offset
>
0
:
in_clause_elements
.
append
(
' OR '
)
in_clause_elements
.
append
(
'
%
s IN ('
%
lhs
)
params
.
extend
(
lhs_params
)
group_size
=
min
(
len
(
rhs_params
)
-
offset
,
max_in_list_size
)
param_group
=
', '
.
join
(
repeat
(
'
%
s'
,
group_size
))
in_clause_elements
.
append
(
param_group
)
in_clause_elements
.
append
(
')'
)
params
.
extend
(
rhs_params
[
offset
:
offset
+
max_in_list_size
])
in_clause_elements
.
append
(
')'
)
return
''
.
join
(
in_clause_elements
),
params
else
:
return
super
(
In
,
self
)
.
as_sql
(
qn
,
connection
)
default_lookups
[
'in'
]
=
In
...
...
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