Board index » delphi » Records not committing on ApplyUpdates

Records not committing on ApplyUpdates


2005-04-13 08:26:38 PM
delphi40
Delphi 6
Interbase
IBX
I have a problem with a clientdataset/provider. there is a master table with
a nested dataset.
The server components are TIBQuerys and the Transaction.AutoStop Action is
saCommit.
When I apply updates from the client all seems fine, except the transaction
does not seem to commit - I can not see the chamges usign IBConsole. In fact
the changes do not seem to commit until the Client Dataset is destroyed (ie
when the datamodule is freed).
Any help, greatly appreciated.
 
 

Re:Records not committing on ApplyUpdates

"Russell Weetch" <XXXX@XXXXX.COM>wrote in
Quote
When I apply updates from the client all seems fine, except the
transaction does not seem to commit - I can not see the chamges usign
IBConsole. In fact the changes do not seem to commit until the Client
Dataset is destroyed (ie when the datamodule is freed).
I'm not familiar with InterBase nor IBX, but this may be a clue.
If you use ADO, you can manage transaction likes:
ADOConnection.BeginTrans; //line 1
try
for I := 0 to High(ModifiedDataSets) do
if ModifiedDataSets[I].Active then
begin
ModifiedDataSets[I].CheckBrowseMode;
(ModifiedDataSets[I] as TCustomADODataSet).UpdateBatch;
end;
ADOConnection.CommitTrans; //line 9
except
ADOConnection.RollbackTrans; //line 11
end;
If you do not control the transaction explicitly, it is committed
automatically when the connection close.
As line 1, 9 & 11 shows, I guess IBX has similar methods. Do you use them
correctly?
Regards,
George
 

Re:Records not committing on ApplyUpdates

Are you explicitly starting a transaction in code?
--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
 

Re:Records not committing on ApplyUpdates

No, I am not specifically starting the transaction.
It is strange. This is a big project with many client - remote pairs, yet it
is only this one that has this behaviour, all the rest are fine.
The simple fix which seems to work ok is to commit the transaction in the
providers afterapplyupdates event.
"Bill Todd" <XXXX@XXXXX.COM>writes
Quote
Are you explicitly starting a transaction in code?

--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
 

Re:Records not committing on ApplyUpdates

As TDataSetProvider.InternalApplyUpdates is implemented it doesn't
support nested transactions. If you take a look at the implementation in
Provider.pas, then there are three possibilities:
1) you start explicitly a transaction prior to calling ApplyUpdates (as
Bill Todd said), which would be the most possible
2) An exception (probably unhandled- see QC#8560) is raised during the
apply updates. Hook the Cds.OnReconcileError event (otherwise you will
not be able to figure out if an exception is raised).
3) A bug in IProviderSupport.PSEndTransaction implementation of your
dataset compoent (IBQuery)- not likely
If you say you don't start a transaction explicitly, I'd vote for
option 2.