Home InterBase Firebird Community About us Search Help English Russian
Everything about Borland InterBase and Firebird
Get Firebird power with FIBPlus
 
Anonymous Login / Register
Site News
Third-party Product News
Programming
Miscellaneous
Encyclopedia
FAQ


Search the site


Subscribe the site news

Sections:
News
E-mail:


InterBase World is a Full Member of Firebird Foundation



Login


Hits 2622116
2246
Hosts 152082
718
Visitors 771387
997

7



Powered by Bitrix Site Manager - Content Management & Portal Solutions

Home / Article archives / Programming

FIBPlus. Master-detail. Step 3. AutoCommit Mode. Work in the context of two transactions for avoiding DEADLOCK


02/28/2004  | Views: 5142

Step 3. AutoCommit Mode. Work in the context of two transactions for avoiding DEADLOCK.

pFIBDataSet allows to commit the made changes automatically if you set AutoCommit to True. Now after calling the Post method, pFIBDataSet1 will automatically call pFIBTransaction1.CommitRetaining, saving the changes without closing the query. Such approach decreases the probability of Deadlock, which is possible in the presence of long unclosed transactions, in the context of which were made data changes.

But FIBPlus gives another capability, which practically reduces the probability of Deadlock to zero. TpFIBDataSet can work in the context of two transactions, a long one in the context of which the data are only read and a short one, in the context of which there executed all modifying queries.

Let's rename pFIBTransaction1 into ReadTransaction and add another component called WriteTransaction. After this we set UpdateTransaction of pFIBDataSet1 in WriteTransaction. Thus pFIBDataSet1 is connected to both components of TpFIBTransaction at once:

Figure 13.

Now after calling the Post method pFIBDataSet1 will call Commit of WriteTransaction. But taking into account the fact that the data are read in the context of a different transaction (ReadTransaction), it will not cause close of pFIBDataSet1. So using FIBPlus we have a real AutoCommit mode, which decreases the possibility of Deadlock and does not prevent us from seeing all actual record values. You might know that while using BDE in the AutoCommit mode you cannot get real record values without reopening the query.

See the full example code.

Back to the news section


 Last articles 
09/24/2007 IBSurgeon would like to inform you about a series of free Firebird technical seminars

09/23/2007 Firebird System Tables (Parts II+III)

09/20/2007 Firebird Maestro 7.9 released

09/19/2007 And the Winner is —

09/19/2007 Unable to access fireruby lib - with firebird 2.0.x and ror

news archive