ResultRange

An input range interface to access the rows resulting from an SQL query.

The elements of the range are Row structs. A Row is just a view of the current row when iterating the results of a ResultRange. It becomes invalid as soon as ResultRange.popFront() is called (it contains undefined data afterwards). Use cached to store the content of rows past the execution of the statement.

Instances of this struct are typically returned by Database.execute() or Statement.execute().

Constructors

this
this(Statement statement)
Undocumented in source.

Members

Functions

empty
bool empty()
front
Row front()

Range interface.

oneValue
auto oneValue()

Gets only the first value of the first row returned by the execution of the statement.

popFront
void popFront()

Range interface.

sqlite3_blocking_step
auto sqlite3_blocking_step(Statement statement)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

auto db = Database(":memory:");
db.run("CREATE TABLE test (i INTEGER);
        INSERT INTO test VALUES (1);
        INSERT INTO test VALUES (2);");

auto results = db.execute("SELECT * FROM test");
assert(!results.empty);
assert(results.front.peek!long(0) == 1);
results.popFront();
assert(!results.empty);
assert(results.front.peek!long(0) == 2);
results.popFront();
assert(results.empty);

Meta