• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1from django.db.models.sql import compiler
2from autotest_lib.frontend.afe.model_logic import _quote_name
3
4class SQLCompiler(compiler.SQLCompiler):
5    def get_from_clause(self):
6        from_, params = super(SQLCompiler, self).get_from_clause()
7
8        if hasattr(self.query, "_custom_joins"):
9            for join_dict in self.query._custom_joins:
10                from_.append('%s %s AS %s ON (%s)'
11                             % (join_dict['join_type'],
12                                _quote_name(join_dict['table']),
13                                _quote_name(join_dict['alias']),
14                                join_dict['condition']))
15                params.extend(join_dict['condition_values'])
16
17        return from_, params
18
19class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler):
20    pass
21
22class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
23    pass
24
25class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler):
26    pass
27
28class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler):
29    pass
30
31class SQLDateCompiler(compiler.SQLDateCompiler, SQLCompiler):
32    pass
33