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]

Reply via email to