Documentation Home
MySQL Internals Manual

23.18.21 rnd_init


Initializes a handler for table scanning.


virtual int rnd_init (scan);


scan ;


This is the rnd_init method.

rnd_init() is called when the system wants the storage engine to do a table scan.

Unlike index_init(), rnd_init() can be called two times without rnd_end() in between (it only makes sense if scan=1). then the second call should prepare for the new table scan (e.g if rnd_init allocates the cursor, second call should position it to the start of the table, no need to deallocate and allocate it again

Called from,,,,, and


  • scan

Return Values

There are no return values.


This example is from the CSV storage engine:

int ha_tina::rnd_init(bool scan)

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

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.