I'm not sure about others, but I was talking about the call to the function
that contains the two resultset SP. No matter how many layers you put
between the SP call at some point you need to call a function that will run
that SP.
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 what you're suggesting in your post, something like:
component
getData
SP
resultset1
resultset2
/SP
return resultset
/getData
getFirst
return getData().resultset1
(or return getData()[1])
/getFirst
getSecond
return getData().resultset2
(or return getData()[2])
/getSecond
/component
But within getFirst() and getSecond() you still need to decide how you call
getData and access the two resultsets, struct or array fashion.
Not that it's hugely important! :O)
Ade
-----Original Message-----
From: Marc Campeau [mailto:[EMAIL PROTECTED]
Sent: 03 March 2005 15:24
To: CF-Talk
Subject: Re: Stored Procedures in a CFC
I would do it differently (then returning a struct/array with both
recordset). Please give comments/suggestions/whatevers as I'm just
thinking out loud.
In essence, your SP returns two recordsets which don't hold the same
data, they could be related but they are not the same. Why not create
two methods for your CFC each returning one of these recordsets. They
would both use another private method which would run the SP and then
store its results in private variables. It would also ensure that the
SP isn't run again and again if it's been run recently. Two me that's
better encapsulation. The Application doesn't have to know how the CFC
gets the recordsets all it knows is that by calling either of the
methods it will get back the data it needs.
--
Marc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:197256
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