Subject Re: [IBO] How to retain iboControl values after rollback?
Author Lucas Franzen
"Michael Fung " schrieb:
>
> Luc,
>
> Let me use an example.
>
> 1. client call query.post to insert a record to table A
> 2. after insert trigger (AI) of table A fire up,
> 3. AI insert a record to table B,
> 4. then AI also insert a record to table C, but that failed and an
> exception is raised
> 5. the exception propagate to my client side application
>
> If I do not rollback, changes to table A and B will not be undone if
> I commit later. Am I right? Or, IBO will automatically rollback upon
> exception?

No, you don't have to roll it back.

Example:

procedure SaveData;
begin
with qry do
begin
try
POST; (1)
IB_Transaction.Commit; (2)
except
end;
end;
end;

When you post your query (1) the data is sent to the server, thus the
triggers will be executed. Since one of them fails the post will fail,
too, thus your query will REMAIN in mode dssInsert or dssEdit and the
IB_Transaction.Commit (2) won't be executed, since the post (1) will
cause the exception.

Nothing could be posted so nothing has to be rolled back.
(Always keep in mind that the triggers run within the same
trannsaction.)

Regards

Luc.