Alright, I think I understand now. Thanks for your help! On Nov 8, 9:44 am, Matthew Woodward <[email protected]> wrote: > I think you're still focusing on initialization when you should leave that > out of the picture. That's not at all the place to do what you need to do. > > Set it as a session variable per user, or if there's some other piece of > information you can hang your hat on, have an array of structs with all the > DSNs in the application scope from which you grab the correct DSN per user. > > You can either have your listener access the session scope directly or via > a session facade, or you can have a plugin put the correct DSN in the event > object on every request by grabbing it from the session scope. > > > > > > > > > > On Tue, Nov 8, 2011 at 5:45 AM, RobM <[email protected]> wrote: > > That's what I meant, I thought the listener should pass the dsn string > > to the object (as in example 1 below) not reference the dsn string in > > the object (example 2) However, if I use Example 1 the object only > > gets the dsn it was initialized with unless I reinitialize it, and > > that's the problem. > > > Example 1 (the way I have it now) > > LISTENER: > > <cfset variables.my_obj = CreateObject('Component', > > 'path.component').init(session.customer_dsn)> > > > (functions, etc.) > > > OBJECT: > > <cffunction name="init"> > > <cfargument name="dsn"> > > <cfset variables.dsn = arguments.dsn> > > </cffunction> > > > <cffunction> > > <cfquery datasource="#variables.dsn#"> > > (query) > > </cfquery> > > </cffunction> > > (functions, etc.) > > > Example 2 (what I thought you were suggesting) > > > LISTENER: > > <cfset variables.my_obj = CreateObject('Component', > > 'path.component').init(session.customer_dsn)> > > > (functions, etc.) > > > OBJECT: > > <cffunction name="init"> > > </cffunction> > > > <cffunction> > > <cfquery datasource="#session.customer_dsn#"> > > (query) > > </cfquery> > > </cffunction> > > > (functions, etc.) > > > -- > > Matthew Woodward > [email protected]http://blog.mattwoodward.com > identi.ca / Twitter: @mpwoodward > > Please do not send me proprietary file formats such as Word, PowerPoint, > etc. as attachments.http://www.gnu.org/philosophy/no-word-attachments.html
-- To post to this group, send email to [email protected] For more options and to unsubscribe, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
