summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-01 01:56:59 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-01 01:56:59 +0000
commitc6a404d1e977cae75345594bf264ca103e1a1d33 (patch)
tree0f6880ed5b784917e533efc380245a6180c497f5 /django/db/models/sql/query.py
parentbbea457fbb523f7cae5cff52ac8227c0abf33340 (diff)
Fixed insert/update handling when no database interaction is required.
Fixed #10205 as part of this. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 0f7c1b1d8a..a09854e59b 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -2012,9 +2012,11 @@ class BaseQuery(object):
iterator over the results if the result_type is MULTI.
result_type is either MULTI (use fetchmany() to retrieve all rows),
- SINGLE (only retrieve a single row), or None (no results expected, but
- the cursor is returned, since it's used by subclasses such as
- InsertQuery).
+ SINGLE (only retrieve a single row), or None. In this last case, the
+ cursor is returned if any query is executed, since it's used by
+ subclasses such as InsertQuery). It's possible, however, that no query
+ is needed, as the filters describe an empty set. In that case, None is
+ returned, to avoid any unnecessary database interaction.
"""
try:
sql, params = self.as_sql()