Result

An object encapsulating a single result row or query execution summary. It's lifetime is limited by lifetime of parent mg_session. Also, invoking mg_session_pull ends the lifetime of previously returned mg_result. Implements an InputRange.

Constructors

this
this(mg_session* session, mg_result** result, mg_map* extraParams)

Initial construction of a Result from the given mg_session pointer. Ranges in D first perform a copy of the range object on which they will operate. This means that the original Result instance could not be used to e.g. query the summary since it does not have the last mg_result. Allocate a reference counted mg_result pointer to be shared with all future range copies.

Members

Functions

columns
auto ref columns()

Returns names of columns output by the current query execution.

fetch
auto fetch()

Fetches the next result after a successful pull(). Return: mg_error.MG_SUCCESS on success, an mg_error code on failure.

front
auto front()

Returns the front element of the range. Note: part of InputRange interface

opCast
auto opCast()

Returns true if this result set is valid, false otherwise.

pull
auto pull()

Pulls the next result. Return: mg_error.MG_SUCCESS on success, an mg_error code on failure.

summary
auto summary()

Returns query execution summary as a key/value Map.

Properties

empty
bool empty [@property getter]

Returns true if there are more results to be pulled from the server, false otherwise. Check if the Result is empty. Return: true if empty, false if there are more rows to be fetched. Note: part of InputRange interface

popFront
void popFront [@property getter]

Pops the first element from the range, shortening the range by one element. Note: part of InputRange interface

Meta