2010-04-01 23:10:53 +08:00
|
|
|
from django.db.models.sql import compiler
|
|
|
|
|
2012-08-20 16:46:21 +08:00
|
|
|
|
2010-04-01 23:10:53 +08:00
|
|
|
class SQLCompiler(compiler.SQLCompiler):
|
2014-11-22 00:38:02 +08:00
|
|
|
def as_subquery_condition(self, alias, columns, compiler):
|
|
|
|
qn = compiler.quote_name_unless_alias
|
2013-03-25 00:40:40 +08:00
|
|
|
qn2 = self.connection.ops.quote_name
|
|
|
|
sql, params = self.as_sql()
|
2013-08-30 07:20:00 +08:00
|
|
|
return '(%s) IN (%s)' % (', '.join('%s.%s' % (qn(alias), qn2(column)) for column in columns), sql), params
|
2013-03-25 00:40:40 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2010-04-01 23:10:53 +08:00
|
|
|
class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler):
|
|
|
|
pass
|
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2010-04-01 23:10:53 +08:00
|
|
|
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
|
|
|
|
pass
|
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2010-04-01 23:10:53 +08:00
|
|
|
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler):
|
|
|
|
pass
|
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2010-04-01 23:10:53 +08:00
|
|
|
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler):
|
|
|
|
pass
|