On Tue, 28 Dec 2004 14:18:14 -0400, Matthew Drayer <[EMAIL PROTECTED]> wrote: > > <cfset variables.DSN = "myDataSourceName"> > > This might be a little off the "best CFC practice" topic, but why not create > a second CFC to govern all contact with your database(s)? This way you don't > have to worry about each CFC that lives in your "world" understanding > database lingo and knowing what the datasource names are -- there's only one > spot where it needs to happen. > > We've done this (the component is called database.cfc), and it's really > helped to streamline our code. All queries and other DB-specific > interactions are done through this component. Other CFCs don't need to know > anything about it other than invoking the proper method and passing the right > arguments. >
You absolutely could (and some might say "should" for maintenance reasons) do that. I just didn't want to muddy the waters with OO concepts when all he was looking for was feedback on his syntax and basic usage. While it's good to be cognizant of OO patterns, that's probably a bit beyond the scope of any beginner's use of CFCs. I'd suggest getting the syntax and basic usage down, and then refactor using OO-patterns (via DAOs) later. Regards, Dave. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188895 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

