Description:
The internals manual describes the elements of the FIELD structure as represented on the "wire" for MySQL-4.0 and older like so:
VERSION 4.0
Bytes Name
----- ----
n (Length Coded String) table
n (Length Coded String) name
4 (Length Coded Binary) length
2 (Length Coded Binary) type
2 (Length Coded Binary) flags
1 decimals
n (Length Coded Binary) default
However, it's easy to see this isn't the case from libmysql.c -> unpack_fields(), at least for the column type and length:
field->length= (uint) uint3korr(row->data[2]);
field->type= (enum enum_field_types) (uchar) row->data[3][0];
(unit3korr is a macro from my_global.h):
/*
ATTENTION !
Please, note, uint3korr reads 4 bytes (not 3) !
It means, that you have to provide enough allocated space !
*/
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
I didn't yet check the rest of the elements, but we should double check that at least things match up with how they actually are.
How to repeat:
Via inspection.