Re: Globally inspecting and conditionally altering fetch spec
Re: Globally inspecting and conditionally altering fetch spec
- Subject: Re: Globally inspecting and conditionally altering fetch spec
- From: "Morris, Mark" <email@hidden>
- Date: Wed, 12 Jun 2013 16:07:34 +0000
- Thread-topic: Globally inspecting and conditionally altering fetch spec
I was looking for something like a delegate, but maybe just subclassing ERXEC and overriding objectsWithFetchSpecification would be a more straightforward way to go….
On Jun 12, 2013, at 10:51 AM, "Morris, Mark" <email@hidden> wrote:
> Right, that's what gave me some pause. It looks like, if I want to use a different fetch spec, I need to do the fetch myself in the delegate method and return the results. It would be nice if there was someplace where inspecting and changing the fetch spec was an okay thing to do.
>
> Thanks again!
> Mark
>
> On Jun 11, 2013, at 7:14 PM, Chuck Hill <email@hidden> wrote:
>
>> I don't think that either method intends for you to change the fetch spec. This documentation is just more explicit. The EC one is probably safer to do that in.
>>
>> Chuck
>>
>>
>> On 2013-06-11, at 5:03 PM, Morris, Mark wrote:
>>
>>> Yeah, since I need to modify the fetchSpec's qualifier I guess this one won't work. Looks like EOEditingContext.Delegate's editingContextShouldFetchObjects is the best bet. Thanks!
>>> -- Mark
>>>
>>> On Jun 11, 2013, at 2:14 PM, Chuck Hill <email@hidden> wrote:
>>>
>>>> EODatabaseContext.Delegate is another option:
>>>>
>>>> boolean databaseContextShouldSelectObjects(EODatabaseContext dbCtxt, EOFetchSpecification fetchSpec, EODatabaseChannel dbChannel)
>>>>
>>>> Invoked from the EODatabaseChannel method selectObjectsWithFetchSpecification to tell the delegate that the database channel dbChannel will select objects on behalf of the database context dbCtxt as specified by fetchSpec. If the delegate returns true, the channel will proceed to select the object. If the delegate returns false (possibly after issuing custom SQL against the adaptor) the channel will skip the select and return immediately.
>>>>
>>>> The delegate should not modify fetchSpec's qualifier or fetch order.
>>>>
>>>> Parameters:
>>>> dbCtxt - The database context.
>>>> fetchSpec - The criteria to select and order a group of database records.
>>>> dbChannel - The database channel.
>>>> Returns:
>>>> Should return true to allow the select to proceed, false to cause dbChannel to return immediately.
>>>> See Also:
>>>> EODatabaseChannel.selectObjectsWithFetchSpecification( EOFetchSpecification fetchSpecification, EOEditingContext context)
>>>>
>>>>
>>>>
>>>> On 2013-06-11, at 12:02 PM, Morris, Mark wrote:
>>>>
>>>>> And as I mentioned, my initial thought is by using EOEditingContext.Delegate's editingContextShouldFetchObjects, but I was curious if anyone might know of any gotchas there or if there might be a better approach.
>>>>> -- Mark
>>>>>
>>>>> On Jun 11, 2013, at 1:59 PM, "Morris, Mark" <email@hidden> wrote:
>>>>>
>>>>>> The why is optimization. By altering the qualifier, I can greatly improve performance of these queries (say 20x).
>>>>>>
>>>>>> The what is just that, I need to watch for a certain class of queries, and if I see one, alter its qualifier, then let it continue processing.
>>>>>>
>>>>>> Thanks again!
>>>>>>
>>>>>> -- Mark
>>>>>>
>>>>>> On Jun 11, 2013, at 1:50 PM, George Domurot <email@hidden> wrote:
>>>>>>
>>>>>>> Well then, ya got me. I'm not sure I understand the why/what you're trying to accomplish.
>>>>>>>
>>>>>>> -G
>>>>>>>
>>>>>>>
>>>>>>> On Jun 11, 2013, at 11:23 AM, "Morris, Mark" <email@hidden> wrote:
>>>>>>>
>>>>>>>> Thanks for the response! :-) Aren't those classes usually used explicitly? I'm hoping to watch every single fetch that's generated and pick and choose the ones I want to alter.
>>>>>>>>
>>>>>>>> -- Mark
>>>>>>>>
>>>>>>>> On Jun 11, 2013, at 1:18 PM, George Domurot <email@hidden>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> You may want to take a peak at ERXFetchSpecificationBatchIterator or ERXBatchingDisplayGroup.
>>>>>>>>>
>>>>>>>>> -G
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Jun 11, 2013, at 10:41 AM, "Morris, Mark" <email@hidden> wrote:
>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> If I want to check for a certain class of query, then alter the qualifier before the fetch is executed, any suggestions for the best approach? So far what I've come up with is registering for EOEditingContext.Delegate's editingContextShouldFetchObjects, then performing the fetch from there if the fetch spec matches my conditions.
>>>>>>>>>>
>>>>>>>>>> Thanks for any advice!
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Mark
>>>>>>>>>> _______________________________________________
>>>>>>>>>> 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
>>>>
>>>> --
>>>> Chuck Hill
>>>> Executive Managing Partner, VP Development and Technical Services
>>>>
>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>> http://www.global-village.net/gvc/practical_webobjects
>>>>
>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>>>
>>>> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>> --
>> Chuck Hill
>> Executive Managing Partner, VP Development and Technical Services
>>
>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/gvc/practical_webobjects
>>
>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>
>> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
> _______________________________________________
> 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