Subject | Re: [firebird-support] Concurrency |
---|---|
Author | Ann W. Harrison |
Post date | 2005-09-11T16:52:03Z |
women_lover_best wrote:
Some applications can't keep a transaction open for the time required to
identify the target rows, determine how to change them, and make the
change. One way to handle that issue is to add a version flag to each
record. Use a generator to get a new version number and update the
target records with that number when the record is chosen, and commit
that transaction. When you're ready to make the real changes, check
that the version in the record is still yours.
This process requires considerable discipline - if any transaction
changes a record without updating the version number, you've got
problems. One way to check for undisciplined updates is to have a
trigger that rejects updates where old.version = new.version.
I wouldn't use timestamps - there are just too many opportunities to get
a slightly wrong value and confuse the system.
Regards,
Ann
> Hi,Typically, people rely on transactions to avoid conflicting updates.
> we are developing in .net,and using firebird..how do yu deal with
> concurrency issue.
Some applications can't keep a transaction open for the time required to
identify the target rows, determine how to change them, and make the
change. One way to handle that issue is to add a version flag to each
record. Use a generator to get a new version number and update the
target records with that number when the record is chosen, and commit
that transaction. When you're ready to make the real changes, check
that the version in the record is still yours.
This process requires considerable discipline - if any transaction
changes a record without updating the version number, you've got
problems. One way to check for undisciplined updates is to have a
trigger that rejects updates where old.version = new.version.
I wouldn't use timestamps - there are just too many opportunities to get
a slightly wrong value and confuse the system.
Regards,
Ann