Michael,

Putting aside any questions of "best practices,"

On 10/3/05, Michel Deloux <[EMAIL PROTECTED]> wrote
>
> Why? That cfc returns a query right?


Well, no. It doesn't return anything. You've defined "returntype" as "void."

<cffunction name="getAllNames" output="true" access="public" hint="Get
all names" returntype="void">

If you want it to return a query, the returntype will need to be a query.
And you'll need a <cfreturn> statement, like:

<cfreturn session.qryListNames />

But whether you return it or not, you need to get the query results into the
session scope.

You never set the results of the query into the session. I don't know for
sure, but I don't think naming the query with "session" will touch the
session scope.

Whether you do it inside the CFC or outside, you should run the query (and
probably not use "session" in the name), then explicitly set the results
into a session variable with a <cfset> statement.

There's nothing inherently wrong with accessing the session scope inside a
CFC. It's almost unavoidable in a CFC-based application. What you may be
thinking of is the use of a "session facade" design pattern to avoid the
need for other components to know they're using data stored in the session
scope.

Also, you may have been quickly typing sample code, but your session
variable names don't match, and you've got a missing pound sign.


--
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
530 Means St NW, Suite 110
Atlanta, GA 30318
404.589.0560


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:219981
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