Subject Re: [IBO] Transactions and Stored Procedures
Author Helen Borrie
At 04:17 PM 4/02/2006, you wrote:
>Hello Helen,
>
>I take the liberty to complete the transaction handling. Hope Your
>Honour only forgot to do so - and it isn't me who missed something ;-)

It's OK, if one wants to commit right then...one does not have to
commit until one wants to do so...but it's wrong for this example
code, see correction..


>On Fri, 3 Feb 2006 23:47:32 +0000 (UTC), you wrote:
>
> >IB_Temp is a TIB_DSQL, not a TIB_Query.
> >Its IB_Transaction property is set to be IB_Transaction1:
> >
> >var
> > returnval: string;
> > nr: integer;
> >....
> >returnval :=3D '';
> >nr :=3D [ something!! ]
> > with DataModule1.IB_Temp do
> > try
> > if IB_Transaction.InTransaction then
> > IB_Transaction.Commit;
> > SQL.Clear;
> > SQL.Add('execute procedure RS_SETTEMPABSCHLUSS(:Nr)');
> if not IB_Transaction1.Started then
> IB_Transaction1.StartTransaction;
> > Prepare;
> > ParamByName('Nr').AsInteger :=3D Nr;
> > Execute;
> > returnval :=3D FieldByName('Intern').AsString;
>// IB_Transaction1.Commit;

IB_Transaction.Commit;

> > except
> > ...
>// IB_Transaction1.RollBack;

IB_Transaction.Rollback; // but only if *that* is how you
want to handle it.

> > end;

Did you figure it out, Christian? :-)

Helen