> Perhaps you shoudl use CFTRANSACTION, it will "atomize"
> the individual queries ... that is...
>
> you have an available quantity, say 5, and 2 customers
>
> customer one comes in he wants 3 items, and customer 2
> comes in he wants 3 items, your code is
>
> <CFTRANSACTION>
> <CFQUERY>
>     get number of available items
> </CFQUERY>
>
> <CFIF enough items available>
> <CFQUERY>
>     reduce number of items
> </CFQUERY>
> <CFELSE>
> Say "not enough items"
> </CFIF>
> </CFTRANSACTION>
>
> all the queries between the <CFRANSACTION> tags will for
> all intents and purposes happen simultaneously, that is, for
> customer one (assuming they got into the CFTRANSACTION
> first) they will get the number of available items, and set the
> reduced number _at the same time_.  Customer 2 will then get
> reign over the CFTRANSACTION and they will get the new
> number of available. Think of it as an exclusive lock that the
> database will handle for you, nice and easy.

I've been under the impression that <cftransaction> serializes access to the
entire datasource ... in which case I think I would be more inclined to use
the named cflock approach since it wouldn't affect the performance of any
other pages which might be accessing other parts of the db in question...

Isaac

www.turnkey.to
954-776-0046

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to