summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-12 02:15:14 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-12 02:15:14 +0000
commit77066516a066d69b3c396db40f3855c06f1f1f3f (patch)
treec99b1148bb766a48101eb59ec1fa22b2d1c676e0
parenta584a6b40f8f685f5809eb77de2c7be0b150aeda (diff)
Fixed #10438 -- Fixed MySQL backend behaviour for UPDATE behaviour.
We need to know the number of rows that are matched by an UPDATE query, not just the number of rows that are changed. In the relatively unlikely event that somebody was using Django's cursor proxy and relying on the previous behaviour, well, that isn't the case any longer. We need to this version. Thanks to Daniel Tang for pointing out the solution here. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/backends/mysql/base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index ea80f7874e..f71e5cd99b 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -22,7 +22,7 @@ if (version < (1,2,1) or (version[:3] == (1, 2, 1) and
raise ImproperlyConfigured("MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__)
from MySQLdb.converters import conversions
-from MySQLdb.constants import FIELD_TYPE, FLAG
+from MySQLdb.constants import FIELD_TYPE, FLAG, CLIENT
from django.db.backends import *
from django.db.backends.signals import connection_created
@@ -274,6 +274,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
kwargs['host'] = settings_dict['DATABASE_HOST']
if settings_dict['DATABASE_PORT']:
kwargs['port'] = int(settings_dict['DATABASE_PORT'])
+ # We need the number of potentially affected rows after an
+ # "UPDATE", not the number of changed rows.
+ kwargs['client_flag'] = CLIENT.FOUND_ROWS
kwargs.update(settings_dict['DATABASE_OPTIONS'])
self.connection = Database.connect(**kwargs)
self.connection.encoders[SafeUnicode] = self.connection.encoders[unicode]