Subject | What transaction options to use? |
---|---|
Author | Chad Z. Hower |
Post date | 2004-11-22T22:45:24Z |
Sorry to repost this - it was part of an earlier thread. I know everyone
here are volunteers - just like the Indy team is but hoping someone can save
me a LOT of trial and error....
Basically here is what I need and Im not sure what options to use to achieve
this. I have two types of transactions.
1) Reads. For reads, I don't want them to see anything that has been changed
since the transaction begun - that is they should see a snapshot as the db
was when they started their Tx. If possible an erorr should be thrown if I
attempt to do any writes (inserts or updates) in this type of transaction.
2) Updates. Updates should be like reads, but allow me to write. Updates
should give me an error if I update a row that someone else updated since I
started my transaction.
The read is a bit more flexible, in many cases I could allow it to see data
that has been committed during its transaction. But #2 is really important.
Before coming to IB - we implemented all this ourselves by adding a version
to field to each row and issuing updates in the form of Update xxxx where
version = x and set version = x + 1 If it returned 0 count we knew it failed
and failed the whole transaction.
Im trying to perform the same functionality usign FB's built in txs as they
appear to work in a similar fashion.
I shoud also not be able to delete a record if someone updated (Committed?)
it since I started my transaction, and vice versa.
here are volunteers - just like the Indy team is but hoping someone can save
me a LOT of trial and error....
Basically here is what I need and Im not sure what options to use to achieve
this. I have two types of transactions.
1) Reads. For reads, I don't want them to see anything that has been changed
since the transaction begun - that is they should see a snapshot as the db
was when they started their Tx. If possible an erorr should be thrown if I
attempt to do any writes (inserts or updates) in this type of transaction.
2) Updates. Updates should be like reads, but allow me to write. Updates
should give me an error if I update a row that someone else updated since I
started my transaction.
The read is a bit more flexible, in many cases I could allow it to see data
that has been committed during its transaction. But #2 is really important.
Before coming to IB - we implemented all this ourselves by adding a version
to field to each row and issuing updates in the form of Update xxxx where
version = x and set version = x + 1 If it returned 0 count we knew it failed
and failed the whole transaction.
Im trying to perform the same functionality usign FB's built in txs as they
appear to work in a similar fashion.
I shoud also not be able to delete a record if someone updated (Committed?)
it since I started my transaction, and vice versa.