tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyd, Todd M." <tmbo...@ccis.edu>
Subject RE: User-JDBC-Realm: User case-sensitiv?
Date Fri, 16 May 2008 21:23:20 GMT
Gregor,

You can use "WHERE x LIKE condition" to perform a case-sensitive search
without modifying the structure of the table(s) involved by using the
BINARY keyword.

"SELECT * FROM `foo` WHERE `bar` LIKE BINARY 'tesT'" will not pull the
record "test" or "Test", but only matches the record "tesT".


Todd Boyd
Web Programmer


> -----Original Message-----

8< snip!

> Usually, a database is transparent for the programmer: He doesn't need
> to about the details of the soring-mechanisms, but *what* he has to
> know is that "fooBar" != "FooBar" - fullstop.
> 
> if you application needs a feature, that i.e. a search is
> case-insensitiv, then he will have to code it - there are tons of
> functions available just exactly for this purpose (i.s.
> String.equalsIgnoreCase() etc.).
> 
> Anyways, coming slightly back topic:
> 
> If somebody else should run into the same problem, it's easy to fix by
> either using a sliglty modified "create-table" - statement having the
> "binary"-attribute:
> 
> create table foo (
> 	bar varchar (40) binary not null;
> )
> 
> or changing existing tables using this alter-statement also containing
> the "binary"-attribute:
> 
> alter table [table-name] change [column-name-old] [column-name-new]
> varchar(length) binary;

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message