Re: Qualifier Evaluation Problem
Re: Qualifier Evaluation Problem
- Subject: Re: Qualifier Evaluation Problem
- From: Henrique Prange <email@hidden>
- Date: Wed, 28 Mar 2012 17:18:10 -0300
Hi Kieran,
On 28/03/2012, at 16:07, Kieran Kelleher wrote:
> IIRC, EOQualifier is the problem here. The semantics of in memory evaluation on a keyPath that has a toMany key is different to the SQL result when using the same qualifier in a FetchSpec.
>
> In memory is going to call valueForKeyPath( "pages.empty" ) on each Book object. The result of that valueForKeyPath is probably an NSArray of Booleans and NSArray will never be equal to Boolean.TRUE. Debug step the code and see if that is the case.
>
That is exactly the problem. As soon as WOUnit uses the in-memory evaluation, this misbehavior leads to inaccurate test results. This is really not cool. :(
I'll try to make a fix in WOUnit.
> See the thread from Feb 6/7 with subject "EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains selector?"
>
Thanks for the reference.
Cheers,
Henrique
>
>
> On Mar 28, 2012, at 2:00 PM, Henrique Prange wrote:
>
>> Hi there,
>>
>> I'm trying to fix a problem in WOUnit, but it seems to be a bug in the core qualifier evaluation for objects in memory. Here is a sample code that demonstrates the problem:
>>
>> Page page = Page.createPage(editingContext);
>>
>> page.setEmpty(true);
>>
>> Book book = Book.createBook(editingContext);
>>
>> book.addToPagesRelationship(page);
>>
>> // Get all books with empty pages
>> EOQualifier qualifier = Book.PAGES.append(Page.EMPTY).isTrue();
>>
>> NSArray<Book> result = ERXQ.filtered(new NSArray<Book>(book), qualifier);
>>
>> The result array should contain the Book I've just created, but the array returned is empty. :(
>>
>> Is there an alternative way to evaluate the qualifier in memory? Should I create the qualifier in a different manner? Any clues on how could I fix this problem without writing my own qualifier evaluator?
>>
>> Cheers,
>>
>> Henrique
>> _______________________________________________
>> 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
>
_______________________________________________
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