-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #16408 -- Fixed conversion of dates, and other problems with th…
…e SpatiaLite backend. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
- Loading branch information
Showing
7 changed files
with
93 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django.db.backends.util import typecast_timestamp | ||
from django.db.models.sql import compiler | ||
from django.db.models.sql.constants import MULTI | ||
from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler | ||
|
||
SQLCompiler = compiler.SQLCompiler | ||
|
||
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler): | ||
pass | ||
|
||
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler): | ||
pass | ||
|
||
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler): | ||
pass | ||
|
||
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler): | ||
pass | ||
|
||
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler): | ||
pass | ||
|
||
class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler): | ||
""" | ||
This is overridden for GeoDjango to properly cast date columns, see #16757. | ||
""" | ||
def results_iter(self): | ||
offset = len(self.query.extra_select) | ||
for rows in self.execute_sql(MULTI): | ||
for row in rows: | ||
date = typecast_timestamp(str(row[offset])) | ||
yield date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters