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):
|
2013-05-27 19:59:16 +08:00
|
|
|
def as_subquery_condition(self, alias, columns, qn):
|
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
|
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2010-04-01 23:10:53 +08:00
|
|
|
class SQLDateCompiler(compiler.SQLDateCompiler, SQLCompiler):
|
|
|
|
pass
|
2013-02-10 23:15:49 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2013-02-10 23:15:49 +08:00
|
|
|
class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, SQLCompiler):
|
|
|
|
pass
|