Sergei Golubchik <serg@stripped> wrote on 05/18/2009 04:34:35 AM:
> Hi, Timothy!
> On May 15, Timothy P Clark wrote:
> > Hi,
> > We're trying to figure out the best way to determine a key field's
> > non-padded length in records_in_range().
> > Our storage engine (IBM DB2) stores key values in a format that is
> > different from MySQL's. One consequence of this is that we need to be
> > to determine in handler::records_in_range() the true length of a
> > character field in a key.
> Why do you need to do that ?
The basic answer is because this is how DB2 requires us to construct the
structure that we pass to get the estimate required by records_in_range.
The pad values look like invalid data to the DB2 interface, so we have to
pass the length of the valid data.
Furthermore, since the storage engine often performs character conversion
(ASCII<->EBCDIC or UTF8<->UCS2 or Multi-byte<->UCS2) between MySQL and
DB2, the pad character may end up with an entirely different codepoint
when passed to DB2, thus losing the min/max value property that has within
MySQL. So even if DB2 accepted the pad character, there is no guarantee
that it would have the same semantic as is intended for records_in_range.
> Regards / Mit vielen Grüßen,
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
> / /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server
> /_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
> <___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
> Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
> Vorsitzender des Aufsichtsrates: Martin Häring