Subject Re: about searching in a blob
Author Aage Johansen
On Mon, 28 Jul 2003 19:05:45 +0000 (UTC), Yves Glodt <yg@...> wrote:

> I have this table in my php knowledgebase system:
> CREATE TABLE "ADDRESS" (
> "CATEGORY" INTEGER NOT NULL,
> "NAME" VARCHAR(100) CHARACTER SET ISO8859_1 NOT NULL,
> "KEYINDEX" INTEGER NOT NULL,
> "ADDRESS" BLOB SUB_TYPE TEXT SEGMENT SIZE 100 CHARACTER SET
> ISO8859_1,
> "DATE_MODIFIED" VARCHAR(25) CHARACTER SET ISO8859_1,
> "HOST_MODIFIED" VARCHAR(25) CHARACTER SET ISO8859_1,
> "USER_MODIFIED" VARCHAR(100) CHARACTER SET ISO8859_1
> );
>
> and I have a search functionality which uses this query:
>
> $sth = ibase_query("SELECT KEYINDEX,NAME,CATEGORY,DATE_MODIFIED FROM
> ADDRESS WHERE UPPER(NAME) LIKE '%".strtoupper($_POST['crit'])."%' OR
> ADDRESS LIKE '%".$_POST['crit']."%' ORDER BY 2 DESC");
>
> I know the UPPER/strtoupper stuff for the varchar column is ugly but it
> works. Well for the blob it doesn't, I cannot get (or fake...) case-
> insensitivity with UPPER (I get string conversion errors)...
> How could this be done? I use FirebirdSS-1.0.2.908-0 on RH9


You could try
...
ADDRESS containing 'your string here'
order by 2 desc

"containing" is case insensitive, but possibly not quite perfect with
not-lower-ANSI characters.


--
Aage J.