/usr/lib/python2.7/dist-packages/mysql/connector/django/compiler.py is in python-mysql.connector 1.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # MySQL Connector/Python - MySQL driver written in Python.
import django
from django.db.models.sql import compiler
from django.utils.six.moves import zip_longest
class SQLCompiler(compiler.SQLCompiler):
def resolve_columns(self, row, fields=()):
values = []
index_extra_select = len(self.query.extra_select)
bool_fields = ("BooleanField", "NullBooleanField")
for value, field in zip_longest(row[index_extra_select:], fields):
if (field and field.get_internal_type() in bool_fields and
value in (0, 1)):
value = bool(value)
values.append(value)
return row[:index_extra_select] + tuple(values)
def as_subquery_condition(self, alias, columns, qn):
# Django 1.6
qn2 = self.connection.ops.quote_name
sql, params = self.as_sql()
column_list = ', '.join(
['%s.%s' % (qn(alias), qn2(column)) for column in columns])
return '({0}) IN ({1})'.format(column_list, sql), params
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
if django.VERSION >= (1, 6):
class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, SQLCompiler):
# Django 1.6
pass
|