MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / visit_textclause

Method visit_textclause

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

Source from the content-addressed store, hash-verified

2762 return text
2763
2764 def visit_textclause(self, textclause, add_to_result_map=None, **kw):
2765 if self._collect_params:
2766 self._add_to_params(textclause)
2767
2768 def do_bindparam(m):
2769 name = m.group(1)
2770 if name in textclause._bindparams:
2771 return self.process(textclause._bindparams[name], **kw)
2772 else:
2773 return self.bindparam_string(name, **kw)
2774
2775 if not self.stack:
2776 self.isplaintext = True
2777
2778 if add_to_result_map:
2779 # text() object is present in the columns clause of a
2780 # select(). Add a no-name entry to the result map so that
2781 # row[text()] produces a result
2782 add_to_result_map(None, None, (textclause,), sqltypes.NULLTYPE)
2783
2784 # un-escape any \:params
2785 return BIND_PARAMS_ESC.sub(
2786 lambda m: m.group(1),
2787 BIND_PARAMS.sub(
2788 do_bindparam, self.post_process_text(textclause.text)
2789 ),
2790 )
2791
2792 def visit_tstring(self, tstring, add_to_result_map=None, **kw):
2793 if self._collect_params:

Callers

nothing calls this directly

Calls 3

_add_to_paramsMethod · 0.95
post_process_textMethod · 0.95
subMethod · 0.80

Tested by

no test coverage detected