Subject | RE: [IBO] AutoCommit and TransactionState |
---|---|
Author | IBO Support List |
Post date | 2013-04-25T20:46:18Z |
This sample app was very helpful. I was able to find at least one aspect of
things that was not behaving properly. After an AutoCommit finishes the
transaction state should be tsInactive rather than tsActivePending.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of IBO Support List
Sent: Thursday, April 25, 2013 8:03 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] AutoCommit and TransactionState
Thanks!
You can just send it directly to my email address jason AT jwharton DOT com.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Thomas Lenders
Sent: Thursday, April 25, 2013 2:55 AM
To: IBObjects@yahoogroups.com
Subject: AW: [IBO] AutoCommit and TransactionState
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]
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
things that was not behaving properly. After an AutoCommit finishes the
transaction state should be tsInactive rather than tsActivePending.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of IBO Support List
Sent: Thursday, April 25, 2013 8:03 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] AutoCommit and TransactionState
Thanks!
You can just send it directly to my email address jason AT jwharton DOT com.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Thomas Lenders
Sent: Thursday, April 25, 2013 2:55 AM
To: IBObjects@yahoogroups.com
Subject: AW: [IBO] AutoCommit and TransactionState
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]
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links