Subject RE: [firebird-support] Read uncommitted
Author Alan McDonald
> Thank you for your answer Alan.
>
> If I understand, what you suggest might work when products are "unique"
> (that is, there is only one of each product), but this is not my case.
> I will give an example.
>
> There are a stock of 100 pieces of product A.
>
> Seller 1 is making an order and he inserts a line which includes 70
> pieces of product A.
>
> Seller 2 is making another order and he tries to insert a line which
> includes 50 pieces of product A. The application should tell him there
> is no enough stock because at that moment there are only 30 pieces
> available (100 - 70).
>

The same logic would apply with an additional step of counting the un-locked
items, then if there is enough for the order, locking the first N items with
the update statement until the commit unlocks them and marks them sold.
Alan