Subject | Re: Read uncommitted |
---|---|
Author | emb_blaster |
Post date | 2010-08-17T19:48:10Z |
--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@...> wrote:
Just to be clearer, you mean that Products table would in that case have a column "pieces in Stock" and another "Locked Pieces" that should be updated?
>Hi Alan,
> > 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
>
Just to be clearer, you mean that Products table would in that case have a column "pieces in Stock" and another "Locked Pieces" that should be updated?