MCPcopy
hub / github.com/django/django / Reverse

Class Reverse

django/db/models/functions/text.py:260–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258
259
260class Reverse(Transform):
261 function = "REVERSE"
262 lookup_name = "reverse"
263
264 def as_oracle(self, compiler, connection, **extra_context):
265 # REVERSE in Oracle is undocumented and doesn't support multi-byte
266 # strings. Use a special subquery instead.
267 suffix = connection.features.bare_select_suffix
268 sql, params = super().as_sql(
269 compiler,
270 connection,
271 template=(
272 "(SELECT LISTAGG(s) WITHIN GROUP (ORDER BY n DESC) FROM "
273 f"(SELECT LEVEL n, SUBSTR(%(expressions)s, LEVEL, 1) s{suffix} "
274 "CONNECT BY LEVEL <= LENGTH(%(expressions)s)) "
275 "GROUP BY %(expressions)s)"
276 ),
277 **extra_context,
278 )
279 return sql, params * 3
280
281
282class Right(Left):

Callers 3

test_nullMethod · 0.90
test_basicMethod · 0.90
test_expressionsMethod · 0.90

Calls

no outgoing calls

Tested by 3

test_nullMethod · 0.72
test_basicMethod · 0.72
test_expressionsMethod · 0.72