Postgres module

query_cached

procedure · 1 overloadsince 0.27.0Source

Runs one statement like query_dynamic, prepared under a name and kept in the connection's cache (unless plan is .CUSTOM or the cache is off): the first run parses it, later runs with the same text and parameter types only bind. Typed queries do this on their own.

query_cached :: (
    c: *Connection,
    sql: string,
    args: ..Any,
    plan := Plan.AUTO,
    binary := false
) -> (Result, Pg_Error)

Runs one statement like query_dynamic, prepared under a name and kept in the connection's cache (unless plan is .CUSTOM or the cache is off): the first run parses it, later runs with the same text and parameter types only bind. Typed queries do this on their own.

Parameters

c: *Connection
the connection to run on.
sql: string
the statement text, with $1, $2, ... for the arguments.
args: ..Any
one value per parameter, in order.
plan := Plan.AUTO
.AUTO prepares and caches the statement; .CUSTOM uses the unnamed statement.
binary := false
return result values in the binary format instead of text.

Returns

See also