Creates and populates the cache from the results of the statement.
auto db = Database(":memory:"); db.execute("CREATE TABLE test (msg TEXT, num FLOAT)"); auto statement = db.prepare("INSERT INTO test (msg, num) VALUES (?1, ?2)"); statement.bind(1, "ABC"); statement.bind(2, 123); statement.execute(); statement.reset(); statement.bind(1, "DEF"); statement.bind(2, 456); statement.execute(); auto results = db.execute("SELECT * FROM test"); auto data = RowCache(results); assert(data.length == 2); assert(data[0].front.as!string == "ABC"); assert(data[0][1].as!int == 123); assert(data[1]["msg"].as!string == "DEF"); assert(data[1]["num"].as!int == 456);
Caches all the results of a Statement in memory as ColumnData.
Allows to iterate on the rows and their columns with an array-like interface. The rows can be viewed as an array of ColumnData or as an associative array of ColumnData indexed by the column names.