We have a CF application through which users complete a form. When they
submit, data is inserted into an Access database using logic like this:
<cftransaction action="begin">
<cfset CommitIt=TRUE>
<cftry>
<cfquery...>
>>delete any existing records for this user...<<
</cfquery>
<cfcatch type='database'>
<cfset CommitIt=FALSE>
</cfcatch>
</cftry>
<cfloop index="i" from="1" to="255">
<cftry>
<cfquery...>
>>insert new record from form data<<
</cfquery>
<cfcatch type='database'>
<cfset CommitIt=FALSE>
<cfexit>
</cfcatch>
</cftry>
</cfloop>
<cfif CommitIt is TRUE>
<cftransaction action='Commit'>
<cfelse>
<cftransaction action='Rollback'>
</cfif>
</cftransaction>
The problem we're hitting is that the delete/insertion process takes a
few seconds and when two users click the button almost simultaneously,
one of them is locked out and his data is never written.
Is there a sensible way to queue the delete/insertion so that it works
correctly once the database lock is cleared, rather than failing?
Any advice will be much appreciated.
Thanks in advance,
Malcolm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists