RunnableQuery
Something that knows how to produce a query, and can therefore be run.
This is where the terminal methods live, written once for everything that can be run. Every builder the client offers extends it, and so does a hand-written RawQuery; a subclass supplies the SQL and inherits fetchRows, fetchObjects, fetchField, forEach* and update without restating a line of them.
The names and their meanings are the driver's, unchanged, and parameters are supplied at the terminal as they are there. What these add is the one thing a RunnableQuery knows and a driver query does not: which session to run on. Nothing has to be opened around a query, which is what keeps a single one to a single expression - the session is asked for when a terminal runs, and inside a transaction that is the transaction's own.
They throw, as the driver throws. Where a failure should be a value instead, asResult switches this query to terminals that return one.
Parameters are @name only. Positional $1 placeholders stay reachable where they always were - db.execute { createNativeQuery(…) }.
Inheritors
Properties
Functions
Switches this query to the result style: every terminal on the returned object hands back a DataResult instead of throwing.
Turns this query into a step of a TransactionPlan instead of something to run now.
Carries registered converters into a builder's copy(), alongside whatever clauses it copies.
As fetchField, but the query must return exactly one row rather than at most one.
Runs the query and returns its single row, throwing where the count was anything but one.
Builds the driver query a terminal is about to run, with this query's own converters on it.
Renders the SQL. Called once per terminal call, so a builder may put off assembling it until here.
Registers a ParameterConverter for this query and nothing else.
Registers a ResultConverter for this query and nothing else.