Documentation Home
MySQL Internals Manual

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

23.15.1 Implementing the position() Method

The [custom-engine.html#custom-engine-api-reference-position position()] method is called after every call to rnd_next() if the data needs to be reordered:

void ha_foo::position(const byte *record)

It stores a "position" of a record in this->ref. The contents of this "position" is up to you, whatever value you provide will be returned in a later call to retrieve the row. The only rule - "position" or a row must contain enough information to allow you later to retrieve this very row. Most storage engines will store some form of offset or a primary key value.