compiler.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
  2. from django.db.backends.mysql import compiler
  3. SQLCompiler = compiler.SQLCompiler
  4. class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
  5. def resolve_columns(self, row, fields=()):
  6. """
  7. Integrate the cases handled both by the base GeoSQLCompiler and the
  8. main MySQL compiler (converting 0/1 to True/False for boolean fields).
  9. Refs #15169.
  10. """
  11. row = BaseGeoSQLCompiler.resolve_columns(self, row, fields)
  12. return SQLCompiler.resolve_columns(self, row, fields)
  13. class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
  14. pass
  15. class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):
  16. pass
  17. class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):
  18. pass
  19. class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):
  20. pass
  21. class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):
  22. pass
  23. class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, GeoSQLCompiler):
  24. pass