From 016f12a2c27fd6006d43cc32af734dfd0ea96f98 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 1 Mar 2009 01:59:18 +0000 Subject: [1.0.X] Fixed insert/update handling when no database interaction is required. Fixed #10205 as part of this. Backport of r9926 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9927 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/query.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'django/db/models/sql/query.py') diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 0a9092d77d..79bb2bafbf 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1743,9 +1743,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() -- cgit v1.3