Actually what I am trying to do is to insert the data to the database by directly using
write_row function. Thus I need to convert the fields to a uchar * parameter. In which
level does MySql do this conversion? Thanks,
--- On Sat, 5/16/09, Andy Bennett <andyjpb@stripped> wrote:
From: Andy Bennett <andyjpb@stripped>
Subject: Re: handler.cc:write_row method
To: "Nihal Dindar" <dindarn@stripped>
Date: Saturday, May 16, 2009, 12:21 AM
> I saw that "write_row" method of handler class takes the table fields as uchar *.
How and where are these fields combined and converted to uchar*?
I'm assuming that you are trying to extract the data from MySQL so that your engine
can store it.
The data passed into write_row() in the uchar* buf parameter is in UNIREG format.
Parsing UNIREG by hand is not too difficult but doing so makes things more difficult than
they need to be. You can access the same underlying data via the individual Field objects
starting at table->field.
The federated engine in the MySQL source tree (ha_federated.cc) is a good example of
how to use the Field objects to extract the data from MySQL in write_row() and reinsert
it in rnd_next() (eventually ha_federated::convert_row_to_internal_format()).