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

Method as_custom_sql

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

Source from the content-addressed store, hash-verified

556 # backends:
557 # First is MonkeyPatch of the class.
558 def as_custom_sql(self, compiler, connection):
559 lhs_sql, lhs_params = self.process_lhs(
560 compiler, connection, self.lhs.lhs
561 )
562 rhs_sql, rhs_params = self.process_rhs(compiler, connection)
563 params = lhs_params + rhs_params + lhs_params + rhs_params
564 return (
565 "%(lhs)s >= "
566 "str_to_date(concat(%(rhs)s, '-01-01'), '%%%%Y-%%%%m-%%%%d') "
567 "AND %(lhs)s <= "
568 "str_to_date(concat(%(rhs)s, '-12-31'), '%%%%Y-%%%%m-%%%%d')"
569 % {"lhs": lhs_sql, "rhs": rhs_sql},
570 params,
571 )
572
573 setattr(YearExact, "as_" + connection.vendor, as_custom_sql)
574 self.assertIn(

Callers

nothing calls this directly

Calls 2

process_lhsMethod · 0.45
process_rhsMethod · 0.45

Tested by

no test coverage detected