in my experience a transaction block wont' work across multiple CFCs - maybe I missed something with it but that has been my experience and has been a small part of why CFC adoptation hasn't been that great where I work. Some of the thigns we work with have a lot of related items - and we have separated out these items into logical "components" however, due to the limitation of the cftransaction we don't use the cfc exactly.
instead we have a directory for each object and the directory has a file in it "api.cfm" that provides all of the public and "private" methods for that object. then a controller cfm file that is called when a congoloration of information needs to be stored calls the appropriate folder/api.cfm methods in a specific sequence (Foreign keys and all) so that all objects can be saved and relationships maintained, all within a cftransaction. On Tue, 23 Nov 2004 16:40:01 -0000, Kerry <[EMAIL PROTECTED]> wrote: > > > > heres what i use: > > > > <cfset errmsg=""> > <cfset docommit = true> > <cftransaction action="BEGIN"> > <cftry> > > > <!--- do your queries/cfc calls here ---> > > > > <cfcatch> > <cfset docommit = false> > <cfset errmsg = "#cfcatch.message#,#cfcatch.detail#"> > </cfcatch> > </cftry> > > <cfif docommit> > <cftransaction action="COMMIT"/> > <cfelse> > <cftransaction action="ROLLBACK"/> > </cfif> > </cftransaction> > > <cfif len(errmsg)> > <cfdump var="#cfcatch.tagcontext#"> > </cfif> > > > > > > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of > Ian Skinner > Sent: 23 November 2004 16:19 > To: [EMAIL PROTECTED] > Subject: [CFCDev] Will this <cftransaction> work? > > > > > > > > If I have a block of code that is going to call several queries, and I have > placed the queries into functions of a CFC, can I wrap these calls into a > single transaction? > > > > Basically I will have something like this. > > > > <!--- Update several related tables ---> > > <cftransaction> > > <cfinvoke component="#dataObj#" method="updateTable1" ..> > > > > <cfinvoke component="#dataObj#" method="deleteTable2" .> > > > > <cfloop from="1" to="#something# index="i"> > > <cfif this EQ that> > > <cfinvoke component="#dataObj#" method="insertTable2" .> > > <cfelse> > > <cfinvoke component="#dataObj#" method="updateTable2" .> > > </cfif> > > </cfloop> > > </cftransaction> > > > > Will the <cftransaction> work here allowing all these queries to be rolled > back if any where to fail? > > -------------- > Ian Skinner > Web Programmer > BloodSource > www.BloodSource.org > Sacramento, CA > > "C code. C code run. Run code run. Please!" > - Cynthia Dunning > > Confidentiality Notice: This message including any attachments is for the > sole use of the intended recipient(s) and may contain confidential and > privileged information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > contact the sender and delete any copies of this message. -- Bill http://blog.rawlinson.us ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at [EMAIL PROTECTED]
