mirror of
https://github.com/django/django.git
synced 2025-12-03 16:47:26 +00:00
Fixed #17339 -- Factor out has_result into database backend.
Thanks jonash.
This commit is contained in:
parent
c0a4894dca
commit
95eb68c98f
2 changed files with 11 additions and 3 deletions
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue