> "Contains" is buggy too. It shows false results sometimes. For a "contains
> 'John Smith'" I get the data of "Lara Miller" too in perhaps one of 30
> queries.
noreply@mail.invalid (Patrick Machielse) schrieb:
>> > Betting against the framework is usually a loosing proposition ;-)
>>
[quoted text clipped - 6 lines]
> 'contains' would be broken, many Apple apps would be broken too. Someone
> would probably have noticed...
Yes I know. That is the reason why I'm asking. Meanwhile I'm experienced
enough to know that in 99,9% of the cases the "bug" is nothing else than a
fatamorgana in the vacuum shell between my eyes.
>> "Contains" is buggy too. It shows false results sometimes. For a "contains
>> 'John Smith'" I get the data of "Lara Miller" too in perhaps one of 30
[quoted text clipped - 4 lines]
> the way. For now, my 'money' is on the 2nd option ;-)
>
I did that before and came to the conclusion that I have to use %K and %@ to
overcome this. I this case == as operator works great, also for strings.
Now the point is that I don't need a placeholder because the the query dose
not change that much and I want to store it in a string.
> Does FullName really return what you think it does? Is it a computed
> value?
>
It is a key-value compliant string value of a managed object.
Yes, that is proved and no, it is not computed.
Perhaps I tell you what I do.
In a first step I fetch a a bigger group of managed objects out of the moc.
In a second step I want to query this array for many different kinds of
values. In the case of numeric, boolean or checking against nil I'm able to do
this without the placeholder with a simple NSPredicate predicateWithFormat:
@"(age == 80) and (Adress == nil)"] --- (just an example).
If I want to make a string compare it that is not working. It is working with
strings only if I use the placeholder %K and %@. For my code that would
produce a ugly code, if I had to use it this way and also the documentations
says something else.
Thanx Florian
Patrick Machielse - 29 Dec 2007 19:54 GMT
> Yes I know. That is the reason why I'm asking. Meanwhile I'm experienced
> enough to know that in 99,9% of the cases the "bug" is nothing else than a
> fatamorgana in the vacuum shell between my eyes.
I know the sinking feeling when the excitement of 'it's an Apple bug!'
turns into the disappointment of 'oh no, it's mine...' all too well ;-)
> this without the placeholder with a simple NSPredicate predicateWithFormat:
> @"(age == 80) and (Adress == nil)"] --- (just an example).
> If I want to make a string compare it that is not working. It is working with
> strings only if I use the placeholder %K and %@.
You can always check your assumptions with -[NSPredicate
predicateFormat]. That would tell you the exact string that is
constructed when %K and %@ are replaced and you'd know how to hard-code
it.
patrick
Florian Zschocke - 29 Dec 2007 22:19 GMT
noreply@mail.invalid (Patrick Machielse) schrieb:
>> Yes I know. That is the reason why I'm asking. Meanwhile I'm experienced
>> enough to know that in 99,9% of the cases the "bug" is nothing else than a
[quoted text clipped - 12 lines]
> constructed when %K and %@ are replaced and you'd know how to hard-code
> it.
So, %K dose nothing and %@ set quotes.
Interesting what it makes from "contains" (in) and a date compare (CAST()).
It strips all the quotes.
I can't see any other differences.
It is really wired. I can't believe that such a silly thing keeps me debugging
for hours.
If I find a solution I will poste it here.
Thanx Florian
Florian Zschocke - 30 Dec 2007 11:42 GMT
Florian Zschocke <edv@zschocke-berlin.de> schrieb:
>> I know the sinking feeling when the excitement of 'it's an Apple bug!'
>> turns into the disappointment of 'oh no, it's mine...' all too well ;-)
Indeed, in my case I was looking for objects I had removed form the array
before. The "bug" has melted down. There is some uncertainty left about the
false positive results when I use "contains" or like in combination with a
wildcard (Fullname like 'John Smith*').
Thanx a lot for your patience and help.
Florian
Reinder Verlinde - 30 Dec 2007 17:13 GMT
In article
<5F71A10F-2E6F-4B74-B00A-B5B840F03388%edv@zschocke-berlin.de>,
> noreply@mail.invalid (Patrick Machielse) schrieb:
>
[quoted text clipped - 10 lines]
> It is really wired. I can't believe that such a silly thing keeps me
> debugging for hours.
I haven't used NSPredicate, but have you read
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/ind
ex.html>, in particular
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Art
icles/pCreating.html#//apple_ref/doc/uid/TP40001793-DontLinkElementID_4>
(The 'Format String Summary' in the 'Creating Predicates'
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Art
icles/pCreating.html> page)?
Reinder