Vyacheslav Akhmechet <coffeemug@stripped> writes:
> Ok, I understand now, thank you very much! I just have one more
> question about this. How are variable-sized rows handled? Are they
> still recorded in this buffer (the record buffer passed to write_row),
> or do I have to go through the fields manually, one by one? If
> variable length rows are recorded into this buffer, how can I
> determine its length without looking at every field?
For variable-length fields, space is reserved in the record for the maximum
size of the field plus 1 or 2 bytes for the length. So yes, you can access
a variable-length field without going through all fields. And you can
determine the length using methods on the Field object (or directly by reading
the first 1 or 2 bytes though that's probably a bad idea). There are two
different lengths: the reserved space (max length) and the actual lenght
(which can be smaller).
>>From what I understand if the table contains no blobs and has fixed
> size records, I can dump the buffer passed to write_row into the file
> as is (this is what I'm doing now). If it has blobs, I have to go
Yes, I guess this is more or less what MyISAM does (not sure).
> through the fields to handle blobs properly. Now, variable-sized rows
> and I'm completely unclear about.
You can also just dump for variable-sized fields, but that will be quite
space-inefficient if the actual lenght is much smaller than the maximum.