Subject | Re: [IBO] Hooked in a cycle |
---|---|
Author | Dorin Pacurar |
Post date | 2001-01-09T19:26:45Z |
> What is this in real life?fm:=Tfm.Create(Application);
with fm do try
if not tr.InTransaction then tr.StartTransaction;
p1:=GenId; // GenId is returned by a stored proc from a generator
repeat
wOk:=ShowModal;
if wOk = mrOk then begin
wOp:=Operation(p1,p2..); // p1,p2 are the parameters for SP
if wOp = 0 then try
tr.CommitRetaining;
except
tr.RollbackRetaining;
ShowMessahe(IntToStr(wOp));
end;
end
else tr.RollbackRetaining;
until (wOk = mrCancel) or (wOp = 0);
finally
FreeAndNil(fm);
end;
function Operation(p1,p2..): Integer;
begin
SP.UnPrepare;
Sp.ParamByName('p1').Asxxx:=p1;
.....
SP.Prepare;
SP.ExecSQL;
Result:=SP.ParamByName('RES').AsInteger;
end;
In the creation of fm I open 2 TIB_Queries (same tr).
p2,p3.. are some values from those 2 queries (picked by the user).
Dorin
P.S. For the moment I solved the problem in another way , but still remains
the question.