Hi folks,

I've not used <cftransaction> before, and I'm wondering if this is the right idea. The example on livedocs doesn't show the use of the rollback or commit features, so this is my best guess.

Could someone tell me if I'm doing the right thing?
<cftransaction action="begin">
        <!--- First Delete everything from the back up table --->
        <cftry>
                <cfquery name="Delete" datasource="MyDSN">
                        DELETE FROM BackupTable
                </cfquery>
                
                <cfcatch type="database">
                        <cftransaction action="rollback"/>
                </cfcatch>
        </cftry>
        <!--- copy current data table to BackupTable --->
        <cftry>
                <cfquery name="PerformBackup" datasource="MyDSN">
                        INSERT INTO BackupTable
                        SELECT * FROM ProductionTable
                </cfquery>
                
                <cfcatch type="database">
                        <cftransaction action="rollback"/>
                </cfcatch>
        </cftry>
        <!--- now drop everything from the production table --->
        <cftry>
                <cfquery name="Delete" datasource="MyDSN">
                        DELETE FROM ProductionTable
                </cfquery>
                
                <cfcatch type="database">
                        <cftransaction action="rollback"/>
                </cfcatch>
        </cftry>
        <cftransaction action="commit"/>
</cftransaction>

This is only part of a program, so don't worry that it's not putting any information back into my production table. I'm just wondering about the <cftransaction> code.

Thanks heaps,
Chris

--
http://cjordan.info

_______________________________________________
Reply to DFWCFUG: [email protected] Subscribe/Unsubscribe: http://lists1.safesecureweb.com/mailman/listinfo/list List Archives: http://www.mail-archive.com/list%40list.dfwcfug.org/ http://www.mail-archive.com/list%40dfwcfug.org/ DFWCFUG Sponsors: www.instantspot.com/
 www.teksystems.com/

Reply via email to