PageRenderTime 182ms CodeModel.GetById 80ms app.highlight 3ms RepoModel.GetById 98ms app.codeStats 0ms

/django/contrib/gis/db/backends/spatialite/compiler.py

https://code.google.com/p/mango-py/
Python | 32 lines | 22 code | 7 blank | 3 comment | 4 complexity | 23648eb790a0776fcfcccf354d19c891 MD5 | raw file
 1from django.db.backends.util import typecast_timestamp
 2from django.db.models.sql import compiler
 3from django.db.models.sql.constants import MULTI
 4from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
 5
 6SQLCompiler = compiler.SQLCompiler
 7
 8class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
 9    pass
10
11class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
12    pass
13
14class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):
15    pass
16
17class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):
18    pass
19
20class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):
21    pass
22
23class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):
24    """
25    This is overridden for GeoDjango to properly cast date columns, see #16757.
26    """
27    def results_iter(self):
28        offset = len(self.query.extra_select)
29        for rows in self.execute_sql(MULTI):
30            for row in rows:
31                date = typecast_timestamp(str(row[offset]))
32                yield date