Documentation Home
MySQL Internals Manual

MySQL Internals Manual  /  ...  /  Implementing the rnd_init() Method

23.10.3 Implementing the rnd_init() Method

The method called before any table scan is the [custom-engine.html#custom-engine-api-reference-rnd_init rnd_init()] method. The rnd_init() method 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)

      current_position= next_position= 0;
      records= 0;
      chain_ptr= chain;


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.