Guys .... cumbersome ....
below is my code .... and still .... its not rolling back ... I have 
injected an error in the 2nd insert statement .... but the transaction 
doesn't rolls back... 1st insert takes place... 2nd one has error.... wat 
could be the problem ... dear experts???

<!---//Starting Transaction ----------------------------------------->
<cftransaction>
        <cftry>
                <!---//QUERY1 Insert ---->
                <cfquery name="insertDAP" datasource="#data2#">
                        INSERT STATEMENT 1
                </cfquery>

                <!---//QUERY2 Insert -------->
                <cfquery name="insertMW" datasource="#data2#">
                        INSERT STATEMENT 2
                </cfquery>


                <!---//CFCATCH for Database errors 
---------------------------------->
                <cfcatch type="database">
                        <cflog text="Error Code: #cfcatch.ErrorCode#,
                                                 Error Message: 
#cfcatch.Message#,
                                                 Detail: #cfcatch.Detail#,
                                                 Extended Info: 
#cfcatch.ExtendedInfo#,
                                                 Root Cause: ,
                                                 Type: #cfcatch.Type#,
                                                 Native Error Code: 
#cfcatch.NativeErrorCode#,
                                                 SQL State: #cfcatch.SQLState#,
                                                 SQL: #cfcatch.SQL#,
                                                 Querry Error: "

                                        type="Error" file="SI_ATP.log" 
application="yes">
                        <cftransaction action="rollback" />
                </cfcatch>
        </cftry>
</cftransaction>


--------------------------------------------------
From: "Barney Boisvert" <bboisv...@gmail.com>
Sent: Tuesday, July 28, 2009 1:00 PM
To: "cf-talk" <cf-talk@houseoffusion.com>
Subject: Re: CFTRANSACTION with MS Access Database

>
> The CFTRANSACTION tag takes care of the top-level rollback all on it's
> own.  The explicit rollback is only used if you have logic inside the
> CFTRANSACTION tag that needs to roll back because of some
> non-exception situation.  So you'll get the behaviour you want if you
> remove the CFTRY..CFCATCH stuff and just use the main CFTRANSACTION
> block.
>
> cheers,
> barneyb
>
> On Mon, Jul 27, 2009 at 11:54 PM, Arsalan Tariq
> Keen<arsalk...@hotmail.com> wrote:
>>
>> Dear Fellows,
>>
>> I am trying to use CFTRANSACTION for a multiple insert query to the same 
>> datasource but obviously different tables. Now my need is that if any one 
>> of the INSERT query fails, all the other queries must be rolled-back. If 
>> all of them succeed, then the complete transaction should be committed. 
>> Also, I want to catch the DATABASE error if any occurs in the transaction 
>> using CFTRY for the smooth processing of my CFML page.
>>
>> Now I have tried something like the following code:
>>
>>
>> <cftry>
>>
>>   <!---//Starting Transaction ----------------------------------------->
>>            <cftransaction>
>>
>>                <!---//Query##1 Insert ---->
>>                <cfquery name="insertDAP" datasource="#data2#">
>>                    INSERT statement
>>                </cfquery>
>>
>>                <!---//Query##2 Insert -------->
>>                <cfquery name="insertMW" datasource="#data2#">
>>                 INSERT statement
>>                </cfquery>
>>
>>            </cftransaction>
>>
>> <cfcatch type="database">
>>                <!---//Actions to perform if DATABASE error occurs----->
>>                <cftransaction action="rollback" />
>> </cftry>
>>
>> This code gives the error that the cftransaction tag with empty body must 
>> be nested inside another CFTRANSACTION block. If I do so, then I get an 
>> error for the CFTRY tag that it must have atleast one CFCATCH block.
>>
>> Any remedies.... where am I going wrong?
>>
>> Regards,
>> Arsalan
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325031
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to