O'Reilly logo

MySQL 5.1 Plugin Development by Andrew Hutchings, Sergei Golubchik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading data

As we have learned in the previous chapter, an indexless table can be read using two access patterns—either sequential, with rnd_init() and rnd_next() methods, or a random one with position() and rnd_pos() methods. Let's start with the former:

int ha_html::rnd_next(unsigned char *buf)
{
fseek(fhtml, current_row_end, SEEK_SET);
for (;;) {

This is one of the most complex methods in our storage engine. Let's analyze it line by line. We started by positioning the stream at the end of the last read row, and will be looking for the first non-deleted row (remember that a row starts with a<tr> tag, while a deleted row starts with<!‑‑).

But first we save the offset of the row that we will read, as it may be needed for position(), and check ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required