Skip to main content

Module builder

Module builder 

Source
Expand description

Plan-to-SQL conversion functions.

Converts typed plan trees (ReadPlanTree, MutatePlan, CallPlan) into parameterised SQL queries. This module sits between the plan layer and the statement assemblers: the plan describes what to query, and this module decides how to express it in SQL.

§Pipeline

ReadPlanTree  ──▶ read_plan_to_query()       ──▶ SqlBuilder (SELECT …)
ReadPlanTree  ──▶ read_plan_to_count_query()  ──▶ SqlBuilder (SELECT COUNT(*) …)
MutatePlan    ──▶ mutate_plan_to_query()      ──▶ SqlBuilder (INSERT / UPDATE / DELETE …)
CallPlan      ──▶ call_plan_to_query()         ──▶ SqlBuilder (SELECT func(…) …)

Functions§

call_plan_to_query
Convert a CallPlan into a function call query.
mutate_plan_to_query
Convert a MutatePlan into an INSERT, UPDATE, or DELETE query.
read_plan_to_count_query
Convert a ReadPlanTree into a COUNT query.
read_plan_to_query
Convert a ReadPlanTree into a SELECT query.