Author: mtredinnick
Date: 2009-04-11 21:15:14 -0500 (Sat, 11 Apr 2009)
New Revision: 10532
Modified:
django/trunk/django/db/backends/mysql/base.py
Log:
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.
Modified: django/trunk/django/db/backends/mysql/base.py
===================================================================
--- django/trunk/django/db/backends/mysql/base.py 2009-04-12 02:05:43 UTC
(rev 10531)
+++ django/trunk/django/db/backends/mysql/base.py 2009-04-12 02:15:14 UTC
(rev 10532)
@@ -22,7 +22,7 @@
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 @@
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]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---