Purpose
Reads the next row from a table and returns it to the server.
Synopsis
virtual int rnd_next
( |
buf) ; |
|
Description
This is the rnd_next
method.
This is called for each row of the table scan. When you run out
of records you should return HA_ERR_END_OF_FILE. Fill buff up
with the row information. The Field structure for the table is
the key to getting data into buf in a manner that will allow the
server to understand it.
Called from filesort.cc, records.cc, sql_handler.cc,
sql_select.cc, sql_table.cc, and sql_update.cc.
Parameters
Return Values
There are no return values.
Usage
This example is from the ARCHIVE
storage
engine:
int ha_archive::rnd_next(byte *buf)
{
int rc;
DBUG_ENTER("ha_archive::rnd_next");
if (share->crashed)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
if (!scan_rows)
DBUG_RETURN(HA_ERR_END_OF_FILE);
scan_rows--;
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
current_position= gztell(archive);
rc= get_row(archive, buf);
if (rc != HA_ERR_END_OF_FILE)
records++;
DBUG_RETURN(rc);
}