Re: Qualifiers LIKE problem
Re: Qualifiers LIKE problem
- Subject: Re: Qualifiers LIKE problem
- From: Greg <email@hidden>
- Date: Fri, 8 Apr 2005 11:43:21 +1000
I understand, so in the documentation for EOQualifier,
<Quote>
Using Wildcards and the like Operator
When you use the like or caseInsensitiveLike operator in a qualifier
expression, you can use the wildcard characters and ? to perform
pattern matching, for example:
"lastName like 'Jo '"
matches Jones, Johnson, Jolsen, Josephs, and so on.
</Quote>
Is this example correct? Can you specify with the single quotes a
literal string with a space and it act like a *?
Greg
On 08/04/2005, at 11:33 AM, Sacha Mallais wrote:
On Apr 7, 2005, at 6:02 pm, Greg wrote:
If you do %@*, causing it to throw an exception when parsing. Why
can't you put the wildcard in the string?
Greg:
%@ in a qualifier isn't quite like %s in a format string (in fact, %s
in a qualifier isn't quite like %s in a format string either...).
It's supposed to work for _any_ object, so for example, if I had Order
and OrderItems, I could construct a qualifier for OrderItems with
this:
EOQualifier.qualifierWithQualifierFormat("order = %@", new
NSArray(myOrder));
This would return all OrderItems with the order attribute (i.e.,
relationship) equal to myOrder. This is represented in SQL as an
inner join on the global ID (i.e., primary key) of myOrder.
%@ also, as you've recently discovered, quotes strings properly. It
also handles different types of numbers properly. It's very powerful.
In fact, I very rarely use anything -other- than %@...
Cheers,
sacha
--
Sacha Michel Mallais - 800 lb. gorilla
Global Village Consulting Inc.: http://www.global-village.net/
Bottom posting is your friend:
http://www.river.com/users/share/etiquette/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden