On Thu, 2008-12-04 at 11:16 -0500, Ann W. Harrison wrote:
> Lars-Erik,
> >
> > The trailing spaces (and minimum sort characters) I have been removing
> > so far, I have converted to the given character set, so for f.eks UCS2,
> > I have been looking to remove 0x0020, etc
>
> Whatever the representation for spaces is, that's what we can safely
> remove. Everything else stays.
> >
> > Should it be done like this for trailing zeros as well, so that I in the
> > case of ucs2 should be looking to remove 0x0000?
> >
>
> No - we remove trailings zeros on numeric keys only. Happily they
> don't have collations.
>
>
Aha! Good to hear, the old implementation of
MySQLCollation::computeLength was checking for zeroes, padChars and
minSortChars:
static inline uint computeKeyLength (uint length, const char *key,
char padChar, char minSortChar)
{
for (const char *p = key + length; p > key; --p)
if ((p[-1] != 0) && (p[-1] != padChar) && (p[-1] !=minSortChar))
return (uint) (p - key);
return 0;
}
/Lars-Erik
> Cheers,
>
> Ann
>