1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

[soc2010/query-refactor] Cleaned up the implementation of compiler's has_results method.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/query-refactor@13335 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2010-06-07 20:23:38 +00:00
parent b564f6c661
commit 3507a3e629

View File

@ -664,18 +664,17 @@ class SQLCompiler(object):
return columns return columns
def has_results(self): def has_results(self):
q = self.query.clone() self.query = self.query.clone()
q.add_extra({'a': 1}, None, None, None, None, None) self.query.add_extra({'a': 1}, None, None, None, None, None)
q.select = [] self.query.select = []
q.select_fields = [] self.query.select_fields = []
q.default_cols = False self.query.default_cols = False
q.select_related = False self.query.select_related = False
q.set_extra_mask(('a',)) self.query.set_extra_mask(('a',))
q.set_aggregate_mask(()) self.query.set_aggregate_mask(())
q.clear_ordering(True) self.query.clear_ordering(True)
q.set_limits(high=1) self.query.set_limits(high=1)
compiler = q.get_compiler(using=self.using) return bool(self.execute_sql(SINGLE))
return bool(compiler.execute_sql(SINGLE))
def results_iter(self): def results_iter(self):
""" """