Shouldn't tr. handle be set to nil after a commit/rollback?

Forum related to the ZDBC API-Layer

Moderators: gto, cipto_kh, EgonHugeist

Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 08.01.2007, 17:39

Shouldn't tr. handle be set to nil after a commit/rollback?

Postby magnomp » 10.06.2008, 13:22

My scenario is:
I wrote an UDF that has to query another firebird database in order to get some information.
On the DLL initialization I create a IZConnection and on finalization I close it.
The problem is: When I close the Connection, if I have had previously executed any statement, the application hands when call isc_commit_transaction to commit the previously openned transaction.
I noticed that it hangs only when the commit ocurrs on my finalization code.
So, I tried to set AutoCommit to False on the connection, and then I do a commit after executing my query. As it's not the DLL finalization code, I could do a commit without problems.
But when I try to close the connection, this procedure is executed:

Code: Select all

procedure TZInterbase6Connection.Close;
  if Closed then Exit;

  if FTrHandle <> nil then
    if AutoCommit then
      FPlainDriver.isc_commit_transaction(@FStatusVector, @FTrHandle);
      DriverManager.LogMessage(lcTransaction, FPlainDriver.GetProtocol,
        Format('COMMITT TRANSACTION "%s"', [Database]));
    end else begin
      FPlainDriver.isc_rollback_transaction(@FStatusVector, @FTrHandle);
      DriverManager.LogMessage(lcTransaction, FPlainDriver.GetProtocol,
        Format('ROLLBACK TRANSACTION "%s"', [Database]));
    FTrHandle := nil;
    CheckInterbase6Error(FPlainDriver, FStatusVector, lcDisconnect);

It checks if there is a transaction handle and, if true, do a commit or rollback depending on the AutoCommit property.

But wait, there are no pending transactions! I have openned only one and I have commited it, but the test FTrHandle <> nil is returning true!
So, I ask:
Shouldn't this transaction handle (FTrHandle) be set to nil after a commit/rollback operation?

I'm using Zeos 6.6.2 RC2 and Firebird 2.0

User avatar
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium

Postby mdaems » 10.06.2008, 23:29

Firebird has it's hard and soft commits. Zeoslib is using soft commits (in order to keep the cursors open, I believe).

I just applied some patch by hgourvest allowing hard commits (see testing branch in SVN), but I'm almost sure this will not work when using autocommit and normal zquery components. It's a very experimentalthing for the moment. Use with care and make sure you know what you're doing.


Return to “ZDBC (ZEOS Database Connectivity)”

Who is online

Users browsing this forum: No registered users and 1 guest