SafeResultRange

An input range of SafeRow.

This is returned by the mysql.safe.commands.query functions.

The rows are downloaded one-at-a-time, as you iterate the range. This allows for low memory usage, and quick access to the results as they are downloaded. This is especially ideal in case your query results in a large number of rows.

However, because of that, this SafeResultRange cannot offer random access or a length member. If you need random access, then just like any other range, you can simply convert this range to an array via std.array.array().

A SafeResultRange becomes invalidated (and thus cannot be used) when the server is sent another command on the same connection. When an invalidated SafeResultRange is used, a mysql.exceptions.MYXInvalidatedRange is thrown. If you need to send the server another command, but still access these results afterwords, you can save the results for later by converting this range to an array via std.array.array().

More...

Constructors

this
this(Connection con, ResultSetHeaders rsh, string[] colNames)
Undocumented in source.

Members

Functions

asAA
MySQLVal[string] asAA()

Get the current row as an associative array by column name

close
void close()

Explicitly clean up the MySQL resources and cancel pending results

popFront
void popFront()

Progresses to the next row of the result set - that will then be 'front'

Properties

colNameIndicies
const(size_t[string]) colNameIndicies [@property getter]

An AA to lookup a column's index by name

colNames
const(string)[] colNames [@property getter]

Get the names of all the columns

empty
bool empty [@property getter]

Check whether there are any rows left

front
inout(SafeRow) front [@property getter]

Gets the current row

isValid
bool isValid [@property getter]

Check whether the range can still be used, or has been invalidated.

rowCount
ulong rowCount [@property getter]

Get the number of rows retrieved so far.

Detailed Description

Type Mappings

$(TYPE_MAPPINGS)

Examples

SafeResultRange oneAtATime = myConnection.query("SELECT * from myTable");
SafeRow[]       allAtOnce  = myConnection.query("SELECT * from myTable").array;

Meta