MCPcopy
hub / github.com/django/django / as_custom_sql

Method as_custom_sql

tests/custom_lookups/tests.py:586–599  ·  view source on GitHub ↗
(self, compiler, connection)

Source from the content-addressed store, hash-verified

584 # "as_postgresql" for postgres and so on, but as we don't know
585 # which DB we are running on, we need to use setattr.
586 def as_custom_sql(self, compiler, connection):
587 lhs_sql, lhs_params = self.process_lhs(
588 compiler, connection, self.lhs.lhs
589 )
590 rhs_sql, rhs_params = self.process_rhs(compiler, connection)
591 params = lhs_params + rhs_params + lhs_params + rhs_params
592 return (
593 "%(lhs)s >= "
594 "str_to_date(CONCAT(%(rhs)s, '-01-01'), '%%%%Y-%%%%m-%%%%d') "
595 "AND %(lhs)s <= "
596 "str_to_date(CONCAT(%(rhs)s, '-12-31'), '%%%%Y-%%%%m-%%%%d')"
597 % {"lhs": lhs_sql, "rhs": rhs_sql},
598 params,
599 )
600
601 setattr(
602 CustomYearExact,

Callers

nothing calls this directly

Calls 2

process_lhsMethod · 0.45
process_rhsMethod · 0.45

Tested by

no test coverage detected