# Io Reference

Databases / DBI / DBIResult

|  | A DBI Result created by a call to DBIConn query.
|  | at(index_or_name) Returns the contents of the given field. The parameter can be a field index or a field name. done Close and free the result. This must be called on each result. Failure to do so will cause memory leaks and open queries with the database server. fields Returns a list of field names in the result. first Move the cursor to the first record. foreach([Object], value, message) Loops over the records in the result starting at either the first result (if the cursor has never been moved) or its current location if moved. i.e.
    r := conn query("SELECT * FROM people")
    r foreach(r, r at(1))
The above would start at the first row, however, you can move around in the result set and then foreach would pickup where you left off, for instance, say you wanted to skip the first three rows:
    r := conn query("SELECT * FROM people")
    r seek(4)
    r foreach(r, r at (1))
The above would start at the record #4, not at the beginning. The optional Object parameter would cause a decendent of DBIRecord to be populate instead of the index being set. This allows for advanced functionality. Please see `DBIRecord' for further information and an example. last Move the cursor to the last record. next Move the cursor to the next record. populate(object) Populates a decendent of DBIRecord with the current record's contents. See `DBIRecord' for further explanation and an example. position Return the current row's position (or index). previous Move the cursor to the previous record. seek(row_number) Move the cursor to the nth record. size Returns the number of rows available.