Subject Re: [firebird-php] Re: php case insensitive field access
Author Lester Caine
slobtrot wrote:
> Here's an example:
>
> $sql = "SELECT * FROM CUST WHERE LASTNAME LIKE upper(?) AND FIRSTNAME LIKE upper(?)";
> $sth = ibase_query( $db_handle, $sql, strtoupper($search_var1), strtoupper($search_var2));
> if ($sth) {
> if ($row = ibase_fetch_object($sth)) {
> //$save_in_variable = $row->FIELDNAME;
> }
> }
> ibase_free_result($sth);
>
> --- Infirebird-php@yahoogroups.com, "jackdmason" wrote:
>> >
>> >Using the php interface is there a way to specify in the query the data fields are to be case insensitive such that a query such as:
>> >
>> >SELECT * FROM CUST WHERE LASTNAME LIKE 'mcg%' AND FIRSTNAME LIKE 'jo%'
>> >
>> >will find Josh Mcgee, josh McGee, Joe McGrath, john mcGregor, etc.?

It is not unusual to create triggers for the firstname and lastname fields to
provide uc_fn and uc_ln which are then indexed also, so searching is a lot
faster. Taking it a step further for genealogical data, this field can be a
'sound like' rather then a simple upper case. My own genealogical data actually
uses both fields ;)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk