ApplyUpdates

Viktor

Member
Hi!

I was wondering, how I am suppose to use CachedUpdates with DOA.
With BDE I used to just state something like:
DataSet->ApplyUpdates();

Doa seems to want some TApplyActions to do so. The other way seems to be to use the Session->ApplyUpdates(...);
but there I don't know what Parameters to fill in...

Is there an example on how to use CachedUpdates with DOA? (C++-Builder)

Thanks!
Viktor
 
The TOracleSession->ApplyUpdates function works the same as the TDatabase->ApplyUpdates function. Open array constructors that are used in Delphi can also be used in C++Builder by using the OPENARRAY macro. The following Delphi and C++Builder syntax are equivalent:
Code:
Delphi:
MainSession.ApplyUpdates([ds1, ds2], True);

C++Builder:
MainSession->ApplyUpdates(OPENARRAY(TDataSet *, (ds1, ds2)), true);
Note that the OPENARRAY macro defines both the DataSets and DataSets_Size parameters that you see in the function definition. The TOracleDataSet.ApplyUpdates procedure is undocumented and should not be used.

------------------
Marco Kalter
Allround Automations
 
Thanks for the answer! Finally I know what that OPENARRAY thing is all about! ;-)

Anyhow, I am afraid It won't work.. somehow....
What I get is an Linker Error:
[Linker Fehler] Unresolved external '__fastcall Oracle::TOracleSession::ApplyUpdates(Db::TDataSet * const *, const int, bool)' referenced from D:\EIGENE DATEIEN\LEHRSTUHL\APPLYUPDATES\UNIT1.OBJ

What's wrong?
 
My guess is that you are using C++Builder 5. I had the same problem report yesterday, and this is a C++Builder 5 bug. It somehow cannot deal with the open array parameter in this specific situation, and the only workaround I could come up with is that you include a little Pascal unit in your C++ application. This Pascal unit will call the TOracleSession.ApplyUpdates procedure:
Code:
(* Apply.pas *)
unit Apply;

interface

uses DB, Oracle, OracleData;

procedure ApplyUpdates(Session: TOracleSession;
                       DataSet1: TOracleDataSet;
                       DataSet2: TOracleDataSet;
                       Commit: Boolean);

implementation

procedure ApplyUpdates;
begin
  Session.ApplyUpdates([DataSet1, DataSet2], Commit);
end;

end.
If you compile this unit in C++Builder and include it in your application you can call it like this:

ApplyUpdates(MainSession, ds1, ds2, true);

In C++Builder 3 and 4 things work just fine.

------------------
Marco Kalter
Allround Automations
 
Back
Top