15.9.3. Implementing the rnd_init()
Function
The function called before any table scan is the
rnd_init()
function. The rnd_init()
function is used
to prepare for a table scan, resetting counters and pointers to
the start of the table.
The following example is from the CSV
storage
engine:
int ha_tina::rnd_init(bool scan)
{
DBUG_ENTER("ha_tina::rnd_init");
current_position= next_position= 0;
records= 0;
chain_ptr= chain;
DBUG_RETURN(0);
}
If the scan
parameter is true, the MySQL
server will perform a sequential table scan, if false the MySQL
server will perform random reads by position.