Updating the table
There are three primary methods that modify the table data. They are write_row(), delete_row()
, and update_row()
, which are used by the INSERT, DELETE
, and UPDATE
statements accordingly. In our engine, write_row()
is the most complex one.
int ha_html::write_row(uchar *buf) { if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) table->timestamp_field->set_time(); if (table->next_number_field && buf == table->record[0]) { int error; if ((error= update_auto_increment())) return error; }
Almost every engine's write_row()
method starts with these lines. They update the values of the TIMESTAMP
and AUTO_INCREMENT
fields, if necessary. Strictly speaking, the second—AUTO_INCREMENT
—block is not needed here. Our engine does not support indexes, that is, it can never have an AUTO_INCREMENT
field.
fseek(fhtml, -FOOTER_LEN, SEEK_END); fprintf(fhtml, "<tr>");
We write a new row at the end of the file. That is, we position the stream...