diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2012-02-29 17:46:23 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2012-02-29 17:46:23 +0000 |
| commit | ae640e5ea08809f56be20957895a61168dbfaeca (patch) | |
| tree | 074a9f347cea72aa6b8a8cbae8c7e29b1f375ba1 /django/db | |
| parent | c471cfd67425a6394a6f91bf6e71573e8f482850 (diff) | |
Fixed #17796 -- Rolled back [17588] because the fix for the original relatively
corner case (boolean fields under MySQL spatial backend) had a wider scope with
potentially unintended consequences affecting the main MySQL backend and the
required changes wouldn't be appropiate at this point of the 1.4 development
cycle.
Refs #15169.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17603 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/mysql/base.py | 6 | ||||
| -rw-r--r-- | django/db/backends/mysql/compiler.py | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 5ad7b893e8..e30cb90a93 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -190,12 +190,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): class DatabaseOperations(BaseDatabaseOperations): compiler_module = "django.db.backends.mysql.compiler" - def convert_values(self, value, field): - if (field and field.get_internal_type() in ("BooleanField", "NullBooleanField") and - value in (0, 1)): - value = bool(value) - return value - def date_extract_sql(self, lookup_type, field_name): # http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html if lookup_type == 'week_day': diff --git a/django/db/backends/mysql/compiler.py b/django/db/backends/mysql/compiler.py index 3fd536c0c6..bd4105ff8e 100644 --- a/django/db/backends/mysql/compiler.py +++ b/django/db/backends/mysql/compiler.py @@ -5,7 +5,10 @@ class SQLCompiler(compiler.SQLCompiler): values = [] index_extra_select = len(self.query.extra_select.keys()) for value, field in map(None, row[index_extra_select:], fields): - values.append(self.query.convert_values(value, field, connection=self.connection)) + if (field and field.get_internal_type() in ("BooleanField", "NullBooleanField") and + value in (0, 1)): + value = bool(value) + values.append(value) return row[:index_extra_select] + tuple(values) class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler): |
