Subject | Re: [firebird-support] How would Firebird handle this. |
---|---|
Author | Iwan Cahyadi Sugeng |
Post date | 2012-12-27T14:46:36Z |
Basically firebird won't corrupt data easily, because it will always save
the last commited transaction and there is no problem with having
concurrent transaction on the same record, but the real problem lies on the
data integrity problem, See below table for more detail:
User Transaction Balance
10
User1 -5 5
User2 -3 2
User3 -7 -5
So opening balance is 10, all user only knows that the balance is 10, so
all user transaction is valid, but because you are saving the stock in a
field, then you would get unknown value for each user transaction and will
cause inconsistency. I Suggest you count the stock and store only the
transaction value
the last commited transaction and there is no problem with having
concurrent transaction on the same record, but the real problem lies on the
data integrity problem, See below table for more detail:
User Transaction Balance
10
User1 -5 5
User2 -3 2
User3 -7 -5
So opening balance is 10, all user only knows that the balance is 10, so
all user transaction is valid, but because you are saving the stock in a
field, then you would get unknown value for each user transaction and will
cause inconsistency. I Suggest you count the stock and store only the
transaction value
On Thu, Dec 27, 2012 at 6:12 PM, Werner F. Bruhin <werner.bruhin@...>wrote:
> **
>
>
> On 27/12/2012 02:12, Andrew Gable wrote:
> >
> > Hello everyone,
> >
> > Just a quick question. I have 5 font end terminals connected to a
> > firebird 2.1 server
> > how would it handle say all the front end apps updating the same record
> >
> > eg a item 1001 is sold on the front ends and when the transaction is
> > done the front ends find the product and does current stock -1 and
> > then does a update on the record to save the new stock level into the
> > database
> >
> > is this fine or is there something better I can do so the records do
> > not get corrupted
> >
> > thanks (I know it is a daft question but I've never had more then 2
> > machines on the server)
> >
> Wanted to read up on this again, currently use FB in single user mode
> (embedded) but working on a project where this could be an issue for me
> too.
>
> So, followed Leonardo's advice, but added a word ;-) - i.e. googling on
> "transaction isolation levels firebird" gives quite a few good links.
>
> Just a few I found interesting:
>
> http://www.firebirdsql.org/manual/isql-transactions.html
>
> http://www.firebirdsql.org/file/documentation/papers_presentations/html/paper-fbent-acid.html
> http://ibexpert.net/ibe/index.php?n=Doc.TransactionOptionsExplained
>
> Werner
>
>
> [Non-text portions of this message have been removed]
>
>
>
--
Iwan Cahyadi Sugeng
Interaktif Cipta Lestari
[Non-text portions of this message have been removed]