summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-12-03 03:31:26 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-12-03 03:31:26 +0000
commit4ea96c04688a017c846b9c01ab68b8df6be866a9 (patch)
tree819d0880c7dd35b3fbbded3d338fa32b119e30ec
parent7b9732a4a46aae6bf294b1869d58f21909ea91cc (diff)
queryset-refactor: Changed execute_sql() to not return an iterator in the
non-MULTI cases when there is an empty result set. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6860 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 907903dc90..e921687c99 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -988,7 +988,10 @@ class Query(object):
try:
sql, params = self.as_sql()
except EmptyResultSet:
- raise StopIteration
+ if result_type == MULTI:
+ raise StopIteration
+ else:
+ return
cursor = self.connection.cursor()
cursor.execute(sql, params)