Hi,
I guess I will be able to implement this in the next release. I will try
using a TreeMap<String, V>(String.CASE_INSENSITIVE_ORDER). If this is a
problem I might replace it with:
/**
* A hash map with a case-insensitive string key.
*
* *@param* <V> the value type
*/
*public* *class* CaseInsensitiveMap<V> *extends* HashMap<String, V> {
*private* *static* *final* *long* serialVersionUID = 1L;
*public* V get(Object key) {
*return* *super*.get(toUpper(key));
}
*public* V put(String key, V value) {
*return* *super*.put(toUpper(key), value);
}
*public* *boolean* containsKey(Object key) {
*return* *super*.containsKey(toUpper(key));
}
*public* V remove(Object key) {
*return* *super*.remove(toUpper(key));
}
*private* String toUpper(Object key) {
*return* key == *null* ? *null* :
StringUtils.toUpperEnglish(key.toString());
}
}
On Friday, October 7, 2011, Thomas Mueller wrote:
> Hi
>
> Thanks, I will try it. It might take a few days (I'm on vacation right
> now).
>
> Regards,
> Thomas
> Am 07.10.2011 11:09 schrieb "Sije de Haan"
> <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>
> >:
>
>>
>>
>> On 30 sep, 21:52, Thomas Mueller
>> <[email protected]<javascript:_e({}, 'cvml',
>> '[email protected]');>>
>> wrote:
>> > Hi,
>> >
>> > I know it is not fully compatible. Currently, H2 internally uses a
>> > HashMap<String, Table>, and it is not so easy to make this case
>> insensitive.
>> > Patches are welcome of couse :-)
>> >
>> > Regards,
>> > Thomas
>> > Am 30.09.2011 16:13 schrieb "Sije de Haan"
>> > <[email protected]<javascript:_e({}, 'cvml',
>> > '[email protected]');>
>> >:
>> >
>> > Adding an extra jar is not necessary, I implemented a
>> CaseInsensitiveHashMap myself, it's only one small source (with a test
>> program). Download it from
>> http://www.dehaansoftware.nl/CaseInsensitiveHashMap.zip
>>
>> Sije
>>
>> >
>> >
>> >
>> >
>> >
>> > > When I set the DATABASE_TO_UPPER property set to false Table- and
>> > > FieldNames are 'stored-as-is', so when I execute 'CREATE TABLE
>> > > Customers ...' and retrieve the metaData I get 'Customers'. That's
>> > > what I want and that's what I need.
>> >
>> > > But what I don't want is to ACCESS the table in a case-sensitive way.
>> > > When I execute two queries:
>> > > SELECT * from Customers
>> > > and
>> > > SELECT * from CUSTOMERS
>> > > I expect both to return the same results because the SQL standard says
>> > > that sql statements should be interpreted in a case-insensitive way.
>> > > With the DATABASE_TO_UPPER set to false I even can execute:
>> > > CREATE TABLE customers
>> > > and
>> > > CREATE TABLE Customers
>> > > ending up with two different tables where the SQL Standard requires
>> > > the second to throw a 'Table already exists' exception.
>> >
>> > > The changelog says:
>> > > "DATABASE_TO_UPPER: when set to false, all identifier names (table
>> > > names, column names) are case sensitive (except aggregate, built-in
>> > > functions, data types, and keywords). This is for improved
>> > > compatibility with MySQL and PostgreSQL"
>> > > But it's not compatible with MySQL at all (and I doubt it is with
>> > > PostgreSql)
>> >
>> > > Sije de Haan
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> Groups
>> >
>> > "H2 Database" group.> To post to this group, send email to
>> [email protected] <javascript:_e({}, 'cvml',
>> '[email protected]');>.
>> > > To unsubscribe from this group, send email to
>> >
>> > [email protected] <javascript:_e({}, 'cvml',
>> 'h2-database%[email protected]');>.> For more options,
>> visit this group at
>> >
>> > http://groups.google.com/group/h2-database?hl=en.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "H2 Database" group.
>> To post to this group, send email to
>> [email protected]<javascript:_e({}, 'cvml',
>> '[email protected]');>
>> .
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:_e({}, 'cvml',
>> 'h2-database%[email protected]');>.
>> For more options, visit this group at
>> http://groups.google.com/group/h2-database?hl=en.
>>
>>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.