Something went wrong. Try again.
SQLite file format and SQL engine in pure OCaml
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334(*--------------------------------------------------------------------------- Copyright (c) 2026 Thomas Gazagnaire. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*)
(** SELECT execution.
A [SELECT] compiles to a register VM program over the sources of a {!Sql.Private.Query.catalog}, or runs on {!Sql.Private.Engine} if it cannot be compiled. [Select] also plans, runs subqueries and renders [EXPLAIN QUERY PLAN]. It reads the database only through {!S}. *)
module type S = Select_intf.S
module Make (R : S) : sig include Select_intf.RUN with type t := R.t
val explain_select : R.t -> Sql.Ast.select -> string (** [explain_select db s] is the plan of [s] from the plan the cursors are built from, one line per loop, sorter and subquery, the plan of each subquery under its line indented two spaces more ({!Sql.Private.Eqp.indented}). *)
val explain_rows : R.t -> Sql.Ast.explain -> Sql.Ast.value list list (** [explain_rows db e] is the rows of [EXPLAIN QUERY PLAN]. An [UPDATE] or a [DELETE] is the plan of the loop that finds its rows, the [WHERE] over the target and an [UPDATE]'s [FROM] after it; a [DELETE] that empties its table at once ({!S.clears}) has none.
@raise Catalog.Error [Prepare _] if [e] is a plain [EXPLAIN] or explains another statement. *)end