parse

Parses sql into its $n form plus the parameter names, in the order the placeholders appear.

Results are cached by SQL text, since the same statement is typically run many times and the parse is pure. The cache is cleared wholesale when it fills rather than evicted entry by entry - a statement that has fallen out is reparsed once, which is cheaper than tracking use.

Return

The rewritten SQL and the names it found.

Parameters

sql

The statement, with @name placeholders.