Question: What differs the TpFIBDataSet.ApplyUpdToBase method from TpFIBDataSet.ApplyUpdates?

Answer: Both methods write changes made in the dataset to the database (if the CachedUpates dataset property is set to True). These methods show different behaviour when working with the local dataset cache.

Sending record changes to the database ApplyUpdates marks the records as processed. When changes of first N records have been successfully applied and N+1 changes were not applied, the transaction cannot be rolled back (as first N records are marked as processed, recurrent ApplyUpdates calls won’t be applied to their changes).

Unlike ApplyUpdates, ApplyUpdToBase does not do any operations with the local cache. This method only sends changes to the server. If you need to mark records as processed, you can use an additional CommitUpdToCache method.

So a successful execution of ApplyUpdates is similar to the consequence of two methods:

ApplyUpdToBase;
CommitUpdToCach;

If you use these two methods, you can handle errors more correctly. E.g.

with TpFIBDataSet1 do
   try
     ApplyUpdToBase;
     UpdateTransaction.Commit;
     CommitUpdToCach; 
      except
      UpdateTransaction.RollBack;
      raise
 end;

If no errors occur after this code is executed, the changes will be successfully applied to the database, committed by Commit and the local dataset cache will be marked as applied. In case any errors occur after the execution of ApplyUpdToBase, all the applied changes will be rolled back (UpdateTransaction.RollBack), and the dataset will be prepared for a new execution.




Preview text: 
Prices in Euro:

235 (1 copy)
1250 (unlimited)

Volume discounts are available...

Navigation



Our 911 dispatch center needed a program to monitor the status of equipment used in emergency situations. If one dispatcher modified the status of a piece of equipment, all the other dispatchers needed to see this change immediately. The most elegant way to implement this was by using Firebird Events to asynchronously notify all the users whenever a pertinent change had occurred at the database server. After failing to implement this myself using the Firebird API, I bought a copy of FIBPlus. I dropped a Database, EventAlert and ErrorHandler control into a C++ Builder DataModule and within minutes I had all the functionality I needed. I was able to complete the project quickly and the users are thrilled with the results because I gave them more features than they originally asked for. >>

Darryl Caillouet Programmer City of Little Rock
FOR CUSTOMERS
Download full versions and updates in your Personal Area