Recognize uncommitted transaction

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mariusz
Posts: 62
Joined: Wed 16 Jul 2008 21:04
Location: Poland / Poznan
Contact:

Recognize uncommitted transaction

Post by mariusz » Mon 15 Sep 2008 07:45

I have an idea to make a button for the users with MyTransaction.Commit when in the transaction are the uncommitted data.
I want to recognize are there uncommitted insert/update/delete queries. Uncommitted select should not highlight “Commit” button. How to provide this? Can anyone help me?

regards
M

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 16 Sep 2008 07:38

You can add some variable to hold the transaction state. Add also handlers for the AfterExecute and AfterUpdateExecute events for all TBCQuery components. The code may look like the following:

procedure TForm1.IBCQuery1AfterExecute(Sender: TObject; Result: Boolean);
begin
if not TCustomIBCDataSet(Sender).IsQuery then
HasUncommitedTransaction := True;
end;

procedure TForm1.IBCQuery1AfterUpdateExecute(Sender: TDataSet;
StatementTypes: TStatementTypes; Params: TDAParams);
begin
if [stInsert, stUpdate, stDelete] * StatementTypes [] then
HasUncommitedTransaction := True;
end;

mariusz
Posts: 62
Joined: Wed 16 Jul 2008 21:04
Location: Poland / Poznan
Contact:

Post by mariusz » Tue 16 Sep 2008 09:26

Thx for your ansfer. I thought, that there is an easyer way to recognize it (by any properties for example)

M.

mariusz
Posts: 62
Joined: Wed 16 Jul 2008 21:04
Location: Poland / Poznan
Contact:

Re: Recognize uncommitted transaction

Post by mariusz » Tue 08 Apr 2014 23:30

Hi... As you can see... some time ago I asked you for a way to detect uncommited transaction. Your solution was so good, so it survived for years. Unfortunately when I upgraded my IBDAC to the version dated on February the 27'th, it does not work anymore. I got a messages:

Undeclared Identifier stInsert, stDelete and
Incompatible types: 'Integer' and '_TStatementtype'

Can you tip me what to use in this case?

regards
Mario

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: Recognize uncommitted transaction

Post by ZEuS » Wed 09 Apr 2014 06:07

To solve the problem, you should add the DASQLGenerator module to the Uses section.
We will change this behavior in the next IBDAC build, so there will be no need to add the DASQLGenerator unit to the USES clause.

mariusz
Posts: 62
Joined: Wed 16 Jul 2008 21:04
Location: Poland / Poznan
Contact:

Re: Recognize uncommitted transaction

Post by mariusz » Wed 09 Apr 2014 16:33

Thank you :)

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: Recognize uncommitted transaction

Post by ZEuS » Thu 10 Apr 2014 04:18

We thank you for your interest in our products.
Feel free to contact us if you have any further questions about IBDAC.

Post Reply