Subject Re: Lithuanian collation
Author peter_jacobi.rm
Hi Jasojona,

--- In firebird-support@yahoogroups.com, "jasajona" wrote:
> Is it possible to get Lithuanian collation drivers for ib or fb? How
can I
> write it by my self if I cannot get it?
>
> Lithuanian character sets are:
> windows-1257 and iso-8859-13

Both these character sets are supported by Firebird (at
least CVS HEAD, but I assume FB 1.5 release makes no
difference here).

No collations are defined for these character sets, except the
default collation, which sorts in codepoint order.

It's not that difficult to add collations. Start reading
the documentation included in Dave's Collate Kit.
http://www.brookstonesystems.com/CollateKit.zip

For additional (and simpler, IMHO) examples, have a look
at my page http://www.jodelpeter.de/i18n/fbarch/index.htm

Then you can go three ways:

1. If recompiling the server and fbintl.dll from the Firebird
Sources is an option for you, you can register your collation
directly in src/jrd/intlnames.h and create a new header file,
consisting mainly of a data table in src/intl/collations

Advantage: New collation is "first class", builtin like all other
collations
Disadvantage: You must compile and distribute your own server

Note, that your patch can be included in CVS HEAD, and perhaps
even in 1.5.1 or 1.5.2

2. You can do the data table as in 1., duplicate or re-create the
code required for a multi-level collation, add the skeleton code
from Dave's or my example and compile it into a fbintl2.dll

Advantage: No need to compile and distribute your own server
Disadvantage: New collation must be registered (like UDFs)

3. If you don't need or want a multi-level collation,
have a look into my pjcolkit_0_3 at mentioned page. The "loadable"
collation can implement a simple collation, plus its no-case and
no-case-no-accent variations. You must only generate a lookup table.

Advantage: No coding, longer strings indexable
Disadvantage: Old fashioned, non multi-level collation. Must
trust or validate my code.

Regards,
Peter Jacobi