My question is, if I set a timeout value of "10" on an exclusive 
lock, what exactly times out?

Is it...
A) The person waiting for the lock will receive an error after 
waiting for 10 seconds?
B) The person using the lock will receive an error if the code inside 
the lock runs for more than 10 seconds?
C) Both?

In case has suggestions...

I'm building an app that has 2 tables. Available_Items and 
Sold_Items. I need to control inventory.

The Available_Items table lists the total number available for each 
item. The Sold_Items table contains a record with the quantity each 
time an item is sold. The values are displayed in a select menu, 1 
thru Available_Items minus Sum(Sold_Items). There may be more than 
one person viewing the select menu at one time.

If there are 4 items available, the select menu will show 1, 2, 3, 
and 4. If user A selects 2 and user B selects 3 and they both submit 
the form at relatively the same time, I'm planning on using an 
exclusive lock to again calculate the number of items available as 
above. The first person to access the lock will be fine and I'll 
insert a new record in the Sold_Items table. The second person 
accessing the lock will get an available value less than the number 
selected in the menu and I'll give them a message to that effect and 
not do the Insert.

I'm going to name the lock thusly:

#variables.dsn#_check_available_items#_form.Item_ID#

If I'm correct, the only users "locked out" will be those that are 
trying to order the same item (form.Item_ID) as a user ordering that 
item. So, if I've got 10 users ordering 10 different items and 1 more 
user ordering one of those items, all simultaneously, then 10 locks 
will be created simultaneously and the only user locked out will be 
one of the 2 that are ordering the same item. Yes? No? Maybe? LOL

Or is there a better way to do this in anyone's opinion.

-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
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