e11d846 has_results
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index cebd77f..037d72d 100644
|
a
|
b
|
class SQLCompiler(object):
|
| 729 | 729 | |
| 730 | 730 | yield row |
| 731 | 731 | |
| | 732 | def has_results(self): |
| | 733 | # This is always executed on a query clone, so we can modify self.query |
| | 734 | self.query.add_extra({'a': 1}, None, None, None, None, None) |
| | 735 | self.query.set_extra_mask(('a',)) |
| | 736 | return bool(self.execute_sql(SINGLE)) |
| | 737 | |
| 732 | 738 | def execute_sql(self, result_type=MULTI): |
| 733 | 739 | """ |
| 734 | 740 | Run the query against the database and returns the result(s). The |
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 4afe288..25b0727 100644
|
a
|
b
|
class Query(object):
|
| 425 | 425 | |
| 426 | 426 | def has_results(self, using): |
| 427 | 427 | q = self.clone() |
| 428 | | q.add_extra({'a': 1}, None, None, None, None, None) |
| 429 | 428 | q.select = [] |
| 430 | 429 | q.select_fields = [] |
| 431 | 430 | q.default_cols = False |
| 432 | 431 | q.select_related = False |
| 433 | | q.set_extra_mask(('a',)) |
| 434 | 432 | q.set_aggregate_mask(()) |
| 435 | 433 | q.clear_ordering(True) |
| 436 | 434 | q.set_limits(high=1) |
| 437 | 435 | compiler = q.get_compiler(using=using) |
| 438 | | return bool(compiler.execute_sql(SINGLE)) |
| | 436 | return compiler.has_results() |
| 439 | 437 | |
| 440 | 438 | def combine(self, rhs, connector): |
| 441 | 439 | """ |