I've tested across multiple CFCs. As long as all db calls are on the
same DB and there's only one cftransaction tag in the line of execution.
Works great!

-Stace

-----Original Message-----
From: Bill Rawlinson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 23, 2004 1:39 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Will this <cftransaction> work?

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]



<table width=800 cellpadding=4 cellspacing=10 border=0><tr bgcolor=BDBDBD><td 
valign=top width=400><font face=verdana size=2 color=FFFFFF><b>AVIS 
IMPORTANT</b></font></td><td valign=top width=400><font face=verdana size=2 
color=FFFFFF><b>WARNING</b></font></td></tr><tr><td valign=top width=400><p 
align=justify><font face=verdana size=1 color=808080> Les informations 
contenues dans le present document et ses pieces jointes sont strictement 
confidentielles et reservees a l'usage de la (des) personne(s) a qui il est 
adresse. Si vous n'etes pas le destinataire, soyez avise que toute divulgation, 
distribution, copie, ou autre utilisation de ces informations est strictement 
prohibee. Si vous avez recu ce document par erreur, veuillez s'il vous plait 
communiquer immediatement avec l'expediteur et detruire ce document sans en 
faire de copie sous quelque forme.</td><td valign=top width=400><p 
align=justify><font face=verdana size=1 color=808080> The information contained 
in this document and attachments is confidential and intended only for the 
person(s) named above. If you are not the intended recipient you are hereby 
notified that any disclosure, copying, distribution, or any other use of the 
information is strictly prohibited. If you have received this document by 
mistake, please notify the sender immediately and destroy this document and 
attachments without making any copy of any kind.</td></tr></table>

----------------------------------------------------------
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]

Reply via email to