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


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197284
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to