Expand description
Helpers for recovering structured pieces (column lists, WHERE clauses,
placeholder counts) from a SQL string that was built by one of the
operations/*::build_sql paths. Driver engines need these when the
dialect can’t emit RETURNING and the driver has to run a follow-up
SELECT keyed on the same WHERE/PK values the original statement used.
Scoped-lexer caveats: these helpers are case-insensitive token scans,
not a real SQL parser. They work correctly on the generated output of
prax-query’s own operations/*::build_sql — they do not try to
handle arbitrary user SQL with string literals containing ? /
where / etc. Callers that accept raw user SQL must either reject
malformed input up front or avoid these helpers.
Functions§
- count_
set_ placeholders - Count the
?placeholders inside an UPDATE statement’s SET clause (betweenSETandWHERE). Used to split bound params between SET values and WHERE values for CQL drivers that need to issue a follow-up SELECT. ReturnsNonewhen the SET window can’t be located. - extract_
insert_ columns - Extract the comma-separated column list from an
INSERT INTO tbl (col1, col2, ...) VALUES …statement. ReturnsNoneif the statement doesn’t have a column list. - extract_
where_ body - Extract the WHERE clause body (everything after the first case-
insensitive
WHEREtoken) from an UPDATE / DELETE / SELECT. ReturnsNoneif there is no WHERE clause.