I think for readability returning the values in a structure is going
to do a.k.a S.Isaac

<cfset data = myCFC.getQueries()>
<cfloop query="data.getUsers">...</cfloop>
<cfloop query="data.getRoles">...</cfloop>

But the idea of going through a function to get the different
recordsets, and referencing via the array would mean that there is no
need to know the name of the queries? defently beneficial.

Cheers everyone for you help

Andy





On Thu, 3 Mar 2005 17:17:48 -0000, Adrian Lynch
<[EMAIL PROTECTED]> wrote:
> Right, but in your getResult1() and getResult2() you access the key named in
> loadData(). That's what I'm saying(asking whether it's) bad. Would array
> syntax not hide better what loadData() does?
> 
> -----Original Message-----
> From: Marc Campeau [mailto:[EMAIL PROTECTED]
> Sent: 03 March 2005 17:04
> To: CF-Talk
> Subject: Re: Stored Procedures in a CFC
> 
> > The cfstoredproc tag will return both queries regardless, you could
> > construct the function to return one of the callers choosing, but from a
> > simplistic approach returning both in either an array or a structure seems
> > more useful. The point I was making was that you either reference them as:
> >
> > function()[1] and function()[2]
> >
> > or:
> >
> > function().resultsetOne and function().resultsetTwo
> >
> > one, the structure, exposes more about the function than the other, the
> > array.
> 
> I understand but I feel like they both expose too much to the application.
> ;)
> 
> I usually prefer structs becauses they're more literate but by
> "hiding" the resultsets in the CFC it doesn't matter whether you use
> an array, struct or whatever.
> 
> I would do this:
> component
>   private datasets = structNew();
>   private isLoaded  = false;
> 
>   private function loadData()
>     if not isLoaded
>       sp
>          result1
>          result2
>       /sp
>       datasets.result1 = result1;
>       datasets.result2 = result2;
>       isLoaded = true;
>     /if
>     return;
>   /function
> 
>   private function getResult1()
>     loadData();
>     return datasets.result1;
>   /function
> 
>   private function getResult2()
>     loadData();
>     return datasets.result2;
>   /function
> /component
> 
> --
> Marc
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 266.6.0 - Release Date: 02/03/2005
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197324
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to