Peter,
Do I have to worry about locking / race conditions?
According to the CFMX7 documentation (if you are using it), you can place your DAO instantiation code within the OnApplicationStart method within Application.cfc and not have to worry about locking.
If not using CFMX7 then you should put a lock around that code and also put conditional logic in ther to instantiate it only once (ie StructKeyExists and the such).
And would it be more efficient to pass the dsn into each data-access method
Why would it be more efficient to do something many times instead of only having to do it once?
My $.02
Jeff
On 5/28/05, Peter H <[EMAIL PROTECTED]> wrote:
----------------------------------------------------------Hi guys,
I create a Dao and place it in the application scope when the app first loads. The init method for my Dao is as follows:
<cfcomponent displayname="MyDAO">
<cfset variables.dsn = '' />
<cffunction name= "Init" access="public" returntype="MyDAO" output="false">
<cfargument name="dsn" type="string" required="true">
<cfset variables.dsn = arguments.dsn />
<cfreturn this />
</cffunction>Variables.dsn is written once during the init method but is read by each data-access method thereafter. Do I have to worry about locking / race conditions? And would it be more efficient to pass the dsn into each data-access method
Cheers, Pete (aka lad4bear)
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone ( www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
--
Who wants a Gmail invite? I have 50 of them
http://nectaar.i989.net/ - Coming Soon ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
