dpeq.command

Commands of various nature. Prepared statement, portal and response demarshalling functions live here.

Members

Classes

FormatCodesOfSpec
class FormatCodesOfSpec(FieldSpec[] spec, alias Demarshaller)
Undocumented in source.
Portal
class Portal(ConnT)

Parameter tuple, bound to prepared statement

PreparedStatement
class PreparedStatement(ConnT)

Pre-parsed sql query with variable parameters.

Functions

blockToTuples
auto blockToTuples(RowBlock block, FieldDescription[]* fieldDescs)

Returns RandomAccessRange of lazily-demarshalled tuples. Customazable with Demarshaller template. Will append parsed field descriptions to fieldDescs array if it is provided.

blockToTuples
auto blockToTuples(Message[] data)

Returns RandomAccessRange of lazy-demarshalled tuples. Customazable with Demarshaller template. This version does not require RowDescription, but cannot validate row types reliably.

blockToVariants
auto blockToVariants(RowBlock block, FieldDescription[]* fieldDescs)

Returns RandomAccessRange of InputRanges of lazy-demarshalled variants. Specific flavor of Variant is derived from Converter.demarshal call return type. Look into marshalling.VariantConverter for demarshal implementation examples. Will append parsed field descriptions to fieldDescs array if passed.

getOneRowBlock
RowBlock getOneRowBlock(ConnT conn, int rowCountLimit, bool requireRowDescription)

Poll messages from the connection until CommandComplete or EmptyQueryResponse is received, and return one row block (result of one and only one query).

getQueryResults
QueryResult getQueryResults(ConnT conn, bool requireRowDescription)

Generic result materializer, suitable for both simple and prepared queries. Polls messages from the connection and builds QueryResult structure from them. Throws if something goes wrong. Polling stops when ReadyForQuery message is received.

postSimpleQuery
void postSimpleQuery(ConnT conn, string query)

Simple query is simple. Send string to server and get responses. The most versatile, but unsafe way to issue commands to PSQL. Simple query always returns data in FormatCode.Text format. Simple queries SHOULD NOT be accompanied by SYNC message, they trigger ReadyForQuery message anyways.

Templates

SpecMapper
template SpecMapper(alias Demarshaller)

Template function Func returns D type wich corresponds to FieldSpec.

TupleForSpec
template TupleForSpec(FieldSpec[] spec, alias Demarshaller = DefaultFieldMarshaller)

for row spec spec build native tuple representation.

Meta

Authors

Boris-Barboris