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
95eb68c9
Kaydet (Commit)
95eb68c9
authored
Tem 08, 2013
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #17339 -- Factor out has_result into database backend.
Thanks jonash.
üst
c0a4894d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
compiler.py
django/db/models/sql/compiler.py
+10
-0
query.py
django/db/models/sql/query.py
+1
-3
No files found.
django/db/models/sql/compiler.py
Dosyayı görüntüle @
95eb68c9
...
...
@@ -750,6 +750,16 @@ class SQLCompiler(object):
yield
row
def
has_results
(
self
):
"""
Backends (e.g. NoSQL) can override this in order to use optimized
versions of "query has any results."
"""
# This is always executed on a query clone, so we can modify self.query
self
.
query
.
add_extra
({
'a'
:
1
},
None
,
None
,
None
,
None
,
None
)
self
.
query
.
set_extra_mask
([
'a'
])
return
bool
(
self
.
execute_sql
(
SINGLE
))
def
execute_sql
(
self
,
result_type
=
MULTI
):
"""
Run the query against the database and returns the result(s). The
...
...
django/db/models/sql/query.py
Dosyayı görüntüle @
95eb68c9
...
...
@@ -401,12 +401,10 @@ class Query(object):
def
has_results
(
self
,
using
):
q
=
self
.
clone
()
q
.
clear_select_clause
()
q
.
add_extra
({
'a'
:
1
},
None
,
None
,
None
,
None
,
None
)
q
.
set_extra_mask
([
'a'
])
q
.
clear_ordering
(
True
)
q
.
set_limits
(
high
=
1
)
compiler
=
q
.
get_compiler
(
using
=
using
)
return
bool
(
compiler
.
execute_sql
(
SINGLE
)
)
return
compiler
.
has_results
(
)
def
combine
(
self
,
rhs
,
connector
):
"""
...
...
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