Subject AW: [IBO] AutoCommit and TransactionState
Author (no author)
Hi Jason,

I made a small demo application, can you see the attached zip archive ?

It needs a small db with the following structure.

My problem is that after posting with autocommit the state is still tsActivePending which also enables the button and causes the CloseWithConfirm function to show a dialog.

Regards,
Thomas


SET SQL DIALECT 3;

CREATE GENERATOR GEN_TBL_DEMO_ID;

CREATE TABLE TBL_DEMO (
DEMOID INTEGER NOT NULL,
"VALUE" VARCHAR(255)
);

ALTER TABLE TBL_DEMO ADD CONSTRAINT PK_TBL_DEMO PRIMARY KEY (DEMOID);

SET TERM ^ ;

/* Trigger: TBL_DEMO_BI */
CREATE OR ALTER TRIGGER TBL_DEMO_BI FOR TBL_DEMO
ACTIVE BEFORE INSERT POSITION 0
as
begin
if (new.demoid is null) then
new.demoid = gen_id(gen_tbl_demo_id,1);
end
^

SET TERM ; ^


Von: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] Im Auftrag von IBO Support List
Gesendet: Mittwoch, 24. April 2013 17:17
An: IBObjects@yahoogroups.com
Betreff: RE: [IBO] AutoCommit and TransactionState



Thomas,

Would you be able to put together a little sample app demonstrating the
problem?

Jason

-----Original Message-----
From: IBObjects@yahoogroups.com<mailto:IBObjects%40yahoogroups.com> [mailto:IBObjects@yahoogroups.com<mailto:IBObjects%40yahoogroups.com>] On Behalf
Of Thomas Lenders
Sent: Wednesday, April 24, 2013 1:16 AM
To: IBObjects@yahoogroups.com<mailto:IBObjects%40yahoogroups.com>
Subject: AW: [IBO] AutoCommit and TransactionState

Hi Jason,

the action I was talking about was TIB_ActionCommitRetaining assigned to a
TButton.
The button is enabled or disabled in the StatusChanged procedure but my
problem is that the transaction state does not change after posting with
AutoCommit=TRUE.

As another way of explaining the problem, I found out that I can get the
behavior I would expect by adding an "AfterCommit" event on the transaction
and manually setting the transaction state with the following ugly
construct:

type TUglyHack = class(TIB_Transaction)
end;

procedure TMyForm.trAfterCommit(Sender: TIB_Transaction);
begin
TUglyHack(tr).SetTransactionState(tsInactive);
end;

I don't really feel comfortable to fiddle with the transaction's state
though that is why I was asking what is the explanation for the state
"ActivePending" after autocommit ?

I don't currently know how to better explain it, hope this helps. The IBO
version I am using is "4.9.14 53".

Regards,
Thomas



[Non-text portions of this message have been removed]