mirror of
https://github.com/django/django.git
synced 2025-07-27 15:14:15 +00:00
Fixed #7190 -- Corrected a problem with Boolean value handling on the MySQL backend. Thanks to George Vilches for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2fa2cf0a09
commit
271bcda04a
4 changed files with 62 additions and 2 deletions
27
django/db/backends/mysql/compiler.py
Normal file
27
django/db/backends/mysql/compiler.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from django.db.models.sql import compiler
|
||||
|
||||
class SQLCompiler(compiler.SQLCompiler):
|
||||
def resolve_columns(self, row, fields=()):
|
||||
values = []
|
||||
for value, field in map(None, row, fields):
|
||||
if (field and field.get_internal_type() in ("BooleanField", "NullBooleanField") and
|
||||
value in (0, 1)):
|
||||
value = bool(value)
|
||||
values.append(value)
|
||||
return tuple(values)
|
||||
|
||||
|
||||
class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler):
|
||||
pass
|
||||
|
||||
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
|
||||
pass
|
||||
|
||||
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler):
|
||||
pass
|
||||
|
||||
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler):
|
||||
pass
|
||||
|
||||
class SQLDateCompiler(compiler.SQLDateCompiler, SQLCompiler):
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue