gizmodel/sql/parsehierarchy
The SQL parser: Oracle outer joins and CONNECT BY.
import * as Parsehierarchy from "gizmodel/sql/parsehierarchy";Methods
Parser.outerJoins
function Parser.outerJoins(self: mut Parser, q: Select): SelectOracle's (+): a FROM list whose WHERE marks the columns of table t joins t by LEFT JOIN, ON the conjuncts that mark it; the other conjuncts stay in WHERE. A conjunct marking two tables, or a column with no table, fails.
Effects: fail, alloc.
Parser.hierarchy
function Parser.hierarchy(self: mut Parser, q: Select, start: Vec<Expr>, connect: Expr, siblings: Vec<Order>): SelectOracle's hierarchical query as a recursive one: FROM t START WITH s CONNECT BY c is WITH RECURSIVE h AS (SELECT t., 1, ... FROM t WHERE s UNION ALL SELECT t., p.level + 1, ... FROM h p JOIN t ON c') SELECT ... FROM h t where c' reads PRIOR x from the parent p. h carries LEVEL, each SYS_CONNECT_BY_PATH and CONNECT_BY_ROOT, the PRIOR keys on the path (a row already on it ends the branch, as NOCYCLE does) and the path of sibling keys, which orders the rows depth first (ORDER SIBLINGS BY, else the PRIOR keys) when no ORDER BY is given. WHERE filters the rows after CONNECT BY, as in Oracle.
Effects: fail, read, alloc.