dpeq.command

Functions of various nature. Prepared statement, portal and response deserialization functions live here.

Members

Classes

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 = null)

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

blockToTuples
auto blockToTuples(immutable(ubyte)[][] data)

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

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

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

getOneRowBlock
RowBlock getOneRowBlock(ConnT conn, int rowCountLimit = 0)

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)

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 Deserializer)

Template function Func returns D type wich corresponds to FieldSpec.

TupleForSpec
template TupleForSpec(FieldSpec[] spec, alias Deserializer = DefaultSerializer)

for row spec spec build native tuple representation.

Meta

Authors

Boris-Barboris