Well - I would have rather been wrong than you.  ;^)

Right now I'm considering setting up some sort of "DoSQL" component -
instantiate it at the beginning of a process, append the SQL to it as the
process continues (perhaps creating mementos as it goes) and then committing
all the SQL at once in one big transaction.

This way even a highly recursive object model (as mine tend to be) could
(pretty cleanly) take advantage of transactions... I'm not sure if you could
still take advantage of CFQUERYPARAM/CFSTOREDPROC however... I'll have to
give it some thought.

In any case it seems like CFTRANSACTION could really use an overhaul.

Jim Davis


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Barney Boisvert
> Sent: Thursday, December 04, 2003 4:40 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] cftransaction with CFC's
> 
> Jim, sure enough, I just tested this on 6.1, and it does NOT behave as
> intended.  I'm quite confident it worked that way on 4.5, but hadn't
> tested
> recently.  The test script I ran is below.  You'll need a datasource named
> 'test' with a table named 'test' containing a varchar column named 'name'
> to
> execute it.
> 
> So, this mechanism will NOT WORK.  My sincerest apologies to all who
> assumed
> I was not speaking from my rear.  Entirely my fault for not double
> checking.
> Back to the drawing board.
> 
> Apologies,
> barneyb
> 
> 
> <cfset request.dsn = "test" />
> 
> <!--- get the initial status of the table --->
> <cfquery datasource="#request.dsn#" name="get">
>       SELECT *
>       FROM test
> </cfquery>
> <cfoutput><p>Current Table Status:</p></cfoutput>
> <cfdump var="#get#" />
> 
> 
> <!--- begin a transaction, running a 'good' query and a 'bad' query --->
> <cftry>
>       <cftransaction action="begin">
> 
>       <cfquery datasource="#request.dsn#" name="">
>               INSERT INTO test
>                       (name)
>               VALUES
>                       ('emery')
>       </cfquery>
> 
>       <cfquery datasource="#request.dsn#" name="">
>               INSERT INTO test
>                       (name)
>               VALUES
>       </cfquery>
> 
>       <cftransaction action="commit">
>       <cfcatch type="any">
>               <cfoutput><p>error occurred:
> #cfcatch.message#</p></cfoutput>
>       </cfcatch>
> </cftry>
> 
> <cfquery datasource="#request.dsn#" name="get">
>       SELECT *
>       FROM test
> </cfquery>
> <cfoutput><p>Current Table Status:</p></cfoutput>
> <cfdump var="#get#" />
> 
> 
> <!--- begin a transaction, running a 'good' query and a 'bad' query,
> manually doing the rollback --->
> <cftry>
>       <cftry>
>               <cftransaction action="begin">
> 
>               <cfquery datasource="#request.dsn#" name="">
>                       INSERT INTO test
>                               (name)
>                       VALUES
>                               ('emery')
>               </cfquery>
> 
>               <cfquery datasource="#request.dsn#" name="">
>                       INSERT INTO test
>                               (name)
>                       VALUES
>               </cfquery>
> 
>               <cftransaction action="commit">
>               <cfcatch type="database">
>                       <cftransaction action="rollback">
>               </cfcatch>
>       </cftry>
>       <cfcatch type="any">
>               <cfoutput><p>error occurred:
> #cfcatch.message#</p></cfoutput>
>       </cfcatch>
> </cftry>
> 
> <cfquery datasource="#request.dsn#" name="get">
>       SELECT *
>       FROM test
> </cfquery>
> <cfoutput><p>Current Table Status:</p></cfoutput>
> <cfdump var="#get#" />
> 
> ----------------------------------------------------------
> 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 www.mail-
> archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
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 www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to