Method: Extralite::Iterator#next
- Defined in:
- ext/extralite/iterator.c
#next ⇒ Hash, ... #next(row_count) ⇒ Array, Extralite::Iterator
Returns the next 1 or more rows from the associated query's result set according to the iteration mode, i.e. as a hash, an array or a single value.
If no row count is given, a single row is returned. If a row count is given,
an array containing up to the row_count
rows is returned. If row_count
is
-1, all rows are returned. If the end of the result set has been reached,
nil
is returned.
If a block is given, rows are passed to the block and self is returned.
94 95 96 97 98 99 |
# File 'ext/extralite/iterator.c', line 94
VALUE Iterator_next(int argc, VALUE *argv, VALUE self) {
Iterator_t *iterator = self_to_iterator(self);
VALUE result = Query_next(argc, argv, iterator->query);
return rb_block_given_p() ? self : result;
}
|