MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / visit_textclause

Method visit_textclause

lib/sqlalchemy/sql/compiler.py:2697–2720  ·  view source on GitHub ↗
(self, textclause, add_to_result_map=None, **kw)

Source from the content-addressed store, hash-verified

2695 return text
2696
2697 def visit_textclause(self, textclause, add_to_result_map=None, **kw):
2698 def do_bindparam(m):
2699 name = m.group(1)
2700 if name in textclause._bindparams:
2701 return self.process(textclause._bindparams[name], **kw)
2702 else:
2703 return self.bindparam_string(name, **kw)
2704
2705 if not self.stack:
2706 self.isplaintext = True
2707
2708 if add_to_result_map:
2709 # text() object is present in the columns clause of a
2710 # select(). Add a no-name entry to the result map so that
2711 # row[text()] produces a result
2712 add_to_result_map(None, None, (textclause,), sqltypes.NULLTYPE)
2713
2714 # un-escape any \:params
2715 return BIND_PARAMS_ESC.sub(
2716 lambda m: m.group(1),
2717 BIND_PARAMS.sub(
2718 do_bindparam, self.post_process_text(textclause.text)
2719 ),
2720 )
2721
2722 def visit_textual_select(
2723 self, taf, compound_index=None, asfrom=False, **kw

Callers

nothing calls this directly

Calls 2

post_process_textMethod · 0.95
subMethod · 0.80

Tested by

no test coverage detected