Thanks for the response. I see what you mean about there being an
"extra" field in the myisam structure.
Can I rely on this extra field to always be the first one if it is
present? This may be enough for my purposes, which are more limited
than the general case.
On Dec 10, 2007 9:08 PM, Sergei Golubchik <serg@stripped> wrote:
> On Dec 09, shlomo.swidler@stripped wrote:
> > Hi, I'm looking for documentation about the structure of the record
> > data stored in the MYD file. There is a very brief (and unclear)
> > section on it here: http://forge.mysql.com/wiki/MySQL_Internals_MyISAM
> > , but I need more.
> > I'm looking to determine what the offset into the record is for each
> > field in the row, and I see that there is an extra byte (or more)
> > present at the beginning if any of the field are allowed to contain
> > null. Where in the C data structures is the info about when this byte
> > is present in the record, so I can take it into account when
> > extracting the field data from the record bytes?
> You cannot really know it. SQL layer has the information about fields,
> their types, and offsets in the row. MyISAM will create a dummy field
> where this "null bitmap" is stored. If you compare the output of
> myisamchk -dvv and SHOW CREATE TABLE you'll see that myisamchk can show
> one field more than the table contains (from the SQL point of view).
> But MyISAM doesn't really know (or care) if this field a "real" one or
> it was only created to provide storage space for NULL bits.
> There's no way you can find it out (in a general case) by looking only
> at MyISAM files.
> Regards / Mit vielen Grüssen,
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
> / /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
> /_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Dachauer Str. 37, D-80335 München
> <___/ Geschäftsführer: Kaj Arnö - HRB
> München 162140