Author: Alex
Date: 2010-06-07 15:23:38 -0500 (Mon, 07 Jun 2010)
New Revision: 13335
Modified:
django/branches/soc2010/query-refactor/django/db/models/sql/compiler.py
Log:
[soc2010/query-refactor] Cleaned up the implementation of compiler's
has_results method.
Modified:
django/branches/soc2010/query-refactor/django/db/models/sql/compiler.py
===================================================================
--- django/branches/soc2010/query-refactor/django/db/models/sql/compiler.py
2010-06-07 20:18:17 UTC (rev 13334)
+++ django/branches/soc2010/query-refactor/django/db/models/sql/compiler.py
2010-06-07 20:23:38 UTC (rev 13335)
@@ -664,18 +664,17 @@
return columns
def has_results(self):
- q = self.query.clone()
- q.add_extra({'a': 1}, None, None, None, None, None)
- q.select = []
- q.select_fields = []
- q.default_cols = False
- q.select_related = False
- q.set_extra_mask(('a',))
- q.set_aggregate_mask(())
- q.clear_ordering(True)
- q.set_limits(high=1)
- compiler = q.get_compiler(using=self.using)
- return bool(compiler.execute_sql(SINGLE))
+ self.query = self.query.clone()
+ self.query.add_extra({'a': 1}, None, None, None, None, None)
+ self.query.select = []
+ self.query.select_fields = []
+ self.query.default_cols = False
+ self.query.select_related = False
+ self.query.set_extra_mask(('a',))
+ self.query.set_aggregate_mask(())
+ self.query.clear_ordering(True)
+ self.query.set_limits(high=1)
+ return bool(self.execute_sql(SINGLE))
def results_iter(self):
"""
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.