db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: Localizing ORDER BY clause
Date Mon, 20 Sep 2004 19:12:09 GMT
wegorkie@interia.pl wrote:

> Hello,
> 
> I need to localize collation order in ORDER BY clauses to Polish locale.
> Is it possible in Derby? When I sort data from table it puts Polish
> diacritics at the end of the sorted list. It should put it according to
> Polish alphabet.
> 
> I read that Derby does not support Polish territory (pl_PL). Does
> territory support include collation ordering? Is it easy to add pl_PL
> support to Derby, I mean for example by adding some resource files?

Derby uses Unicode character (codepoint) values for ordering CHAR and
VARCHAR values.

Previously Cloudscape used natural language collation for ordering
NATIONAL character types (NATIONAL CHAR and NATIONAL VARCHAR). A
specific locale was supported if the JVM supported that locale. The
locale was taken from the database's locale which was fixed at create
database time. Thus in Cloudscape you had fixed sorting for CHAR/VARCHAR
and locale based ordering for NATIONAL types.  I'm not sure this was the
model that most database developers expect.

The national character types are in the Derby code but are disabled.
Any locale based sorting should take advantage of the existing code.
None of this code is specific to a language or locale, that is all
provided by the JVM.

An option is to allow locale based sorting on CHAR/VARCHAR, that is set
the sort order definition at create database time to be locale rather
than codepoint based (optionally).

Another option is to re-enable the national character types and keep the
dual sort model that Cloudscape had. Any re-enabling of the national
types, I think, needs to look carefully at the SQL spec, there were some
issues relating to casts that I think were incorrect.

Or some combination of both.

Dan.

Mime
View raw message