Row.peek

Returns the data of a column.

Contrary to opIndex, the peek functions return the data directly, automatically cast to T, without the overhead of using a wrapped Variant (ColumnData).

  1. T peek(int index)
    struct Row
    T
    peek
    (
    T
    )
    (
    int index
    )
    if (
    isBoolean!T ||
    isIntegral!T
    )
  2. T peek(int index)
  3. T peek(int index)
  4. T peek(int index)
  5. T peek(int index)
  6. T peek(string columnName)

Parameters

T

The type of the returned data. T must be a boolean, a built-in numeric type, a string, an array or a Variant.

index int

The index of the column in the prepared statement or the name of the column, as specified in the prepared statement with an AS clause.

Return Value

Type: T

A value of type T. The returned value is T.init if the data type is NULL. In all other cases, the data is fetched from SQLite (which returns a value depending on its own conversion rules; see http://www.sqlite.org/c3ref/column_blob.html and http://www.sqlite.org/lang_expr.html#castexpr), and it is converted to T using std.conv.to!T.

Condition on TRequested database type
isIntegral!T || isBoolean!TINTEGER, via sqlite3_column_int64
isFloatingPoint!TFLOAT, via sqlite3_column_double
isSomeString!TTEXT, via sqlite3_column_text
isArray!TBLOB, via sqlite3_column_blob
is(T == Nullable!U)NULL or T
Other typesCompilation error

Warnings: The result is undefined if then index is out of range.

If the second overload is used, the names of all the columns are tested each time this function is called: use numeric indexing for better performance.

Meta