I really didn't think this would work in a CFC - each query is within a
method and then put a transaction over the whole lot. I thought that the
transaction wouldn't hold as the method calls went up the stack.

but it works like a dream! 

I got a question though.... it's the db driver that defines what lock
types are available? how would I find out which isolation types are
valid for weirdo JDBC drivers like Informix DB's? SERIALIZABLE isn't
throwing an error (ATM)...

cheers
barry.b


<cffunction name="AddNew" returntype="boolean" access="public">
        <cfset var success = FALSE>
        <cftransaction action="BEGIN" isolation="SERIALIZABLE"> 
        <cftry> 
                <cfset this.REQ_NUM = getNextReqNum()>
                <!---=== get current PKey and set to CFC scope ===--->
                <cfset success = AddNewMaster()>
                <!---=== insert master properties (uses this.REQ_NUM)
===--->
                <cfset success = AddNewDetails()>
                <!---=== unpack arr of structs and insert (uses
this.REQ_NUM) ====--->  
                <cfset success = increaseNextReqNum()>
                <!---=== current PKey + 1, ready for next time ===--->

        
                <cfif success EQ TRUE>
                        <cftransaction action="COMMIT" />
                </cfif> 
                                
                <cfcatch type="Any">
                        <cfset success = FALSE>
                        <cftransaction action="ROLLBACK" />
                        <cfrethrow>
                        <!---=== send error back to the calling page
===--->
                </cfcatch>              
        </cftry> 
        </cftransaction>

        <cfreturn success />
</cffunction>


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to