David,

All that is missing is the wildcard characters in the SQL.  Asterisks
('*') must be added to the beginning and end of your string
'handwashing'. (The wildcard character shows as a percent symbol in the
raw SQL because WO knows what your DB uses.) (I haven't used CONTAINS
myself, but I'm going to guess that WebObjects is putting them in there
automatically.)  

Whether your users add asterisks themselves or you add them in code is
your choice.  If your users are savvy enough, you could instruct them
how to use it, and also teach them they can embed it in the middle
string as well.

HTH,
Chris

-----Original Message-----
Date: Tue, 13 Dec 2005 14:51:34 -0800
From: David Holt <[EMAIL PROTECTED]>
Subject: stringQualifierOperators (like, contains)
To: WebObjects-List Apple <webobjects-dev@lists.apple.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed

I am binding the display group stringQualifierOperators to a pop-up 
button so that users can have some option for how they want to search a 
field. The "CONTAINS" qualifier generates SQL such as this:

SELECT t0.evidence_abstract, t0.title, t0.year_publication FROM 
evidence t0 WHERE UPPER(t0.title) LIKE UPPER('%handwashing%') ESCAPE 
'|'

This is exactly the SQL that I would expect for a case insensitive LIKE 
and returns the results expected.

The "LIKE" qualifier generates this SQL:

SELECT t0.evidence_abstract, t0.title, t0.year_publication FROM 
evidence t0 WHERE t0.title like 'handwashing' ESCAPE '|'

This SQL generates no results even though the word handwashing appears 
in 25 titles.

My question is whether the "like" qualifier should even be there? 
"Contains" gives me the results I expect from a "like" query. I can't 
get the "like" query to generate results under any circumstances, yet 
it is exposed as one of the choices to my users and potentially causes 
confusion. Is anyone else running into this? Am I misunderstanding what 
"like" should be returning because of my background using SQL? Is this 
a bug?

Thanks,
David
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to