~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to django/db/backends/mysql/compiler.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from django.db.models.sql import compiler
 
2
 
 
3
class SQLCompiler(compiler.SQLCompiler):
 
4
    def resolve_columns(self, row, fields=()):
 
5
        values = []
 
6
        index_extra_select = len(self.query.extra_select.keys())
 
7
        for value, field in map(None, row[index_extra_select:], fields):
 
8
            if (field and field.get_internal_type() in ("BooleanField", "NullBooleanField") and
 
9
                value in (0, 1)):
 
10
                value = bool(value)
 
11
            values.append(value)
 
12
        return row[:index_extra_select] + tuple(values)
 
13
 
 
14
class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler):
 
15
    pass
 
16
 
 
17
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
 
18
    pass
 
19
 
 
20
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler):
 
21
    pass
 
22
 
 
23
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler):
 
24
    pass
 
25
 
 
26
class SQLDateCompiler(compiler.SQLDateCompiler, SQLCompiler):
 
27
    pass