Subject Re: [firebird-support] Re: case insensitive "where" clause
Author Alexandre Benson Smith
bwc3068 wrote:
> Thanks for the replies!
>
> Is it just as simple as...when I want to do the case insensitive query, i change the TIB_Connection.CharSet to ISO8859.1 and do the query then change it back to whatever it was (it's actually nothing right now)?
>

No, you have to define the column with a desired character set and
collation.

> I'm not exactly sure how to use that character set for what I need....thanks!
>

See bellow
> and it sounds like the upper(field) won't really effect the speed of the result. Cool.
>

Look at the plan !

If you have a very small table, perhaps the difference would not be
perceptible, but when you have a lot of records, then yes, it makes a
huge difference.

> thanks again
> kelly
>

Create Table Foo(Bar varchar (30) character set iso8859_1 collate PT_BR);

commit;

create index SK_Foo on Foo(Bar);

Insert into Foo values ('A');
Insert into Foo values ('a');
Insert into Foo values ('á');
Insert into Foo values ('Á');
Insert into Foo values ('B');
Insert into Foo values ('C');
Insert into Foo values ('ã');

commit;

select * from Foo where bar = 'a'
Bar
-----
A
a
á
Á
ã


The above query would perform an indexed search and does not make any
distinction (regarding equality) if the value is upper or lower case or
if it is accented or not.
PLAN (FOO INDEX (SK_FOO))


Enjoy !

see you !


--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br