Hi,
we are in the process of testing IBDAC Suite (v. 3.00.0.4 for Delphi 7)
At the end of this message you can see the code of a short method which does not work as expected.
If I execute the method below and open the table Log afterwards in a new transaction (e.g. with IBExpert) I see an inserted record, which is weird because of the "Rollback" at the end of the method.
What is wrong here?
I hope somebody can enlighten me,
Josef
procedure TForm1.Button2Click(Sender: TObject);
begin
IBCQuery2.Transaction.StartTransaction;
with IBCQuery2 do begin
SQL.Clear;
SQL.Add('Insert into Log(Logpriority, Logcontext, Logmessage)');
SQL.Add(' values (:prio, :context, :message)');
ParamByName('prio').AsInteger := 2;
ParamByName('context').AsString := 'IBDAC';
ParamByName('message').AsString := 'Test 1';
ExecSQL;
end;
IBCQuery2.Transaction.Rollback;
end;
Rollback Transaction
-
- Posts: 6
- Joined: Wed 04 Jul 2007 11:40
Hi,
thank you for your quick response.
Yes, with AutoCommit = False the Rollback works, but I think this behavior conflicts with the explanation in IBDAC-help (see below).
Here the text from IBDAC-Help
Class
TCustomIBCDataSet
Syntax
property AutoCommit: boolean;
Remarks
When True and Connection.AutoCommit is True, and Connection.InTransaction is False, each update, insert or delete statement is automatically committed by database server.
-----
The current behavior gives us problems in converting an IBO application to IBDAC, because in IBO, I always could rollback an explicitly started transaction independently from the setting of Autocommit.
Regards,
Josef Gschwendtner
thank you for your quick response.
Yes, with AutoCommit = False the Rollback works, but I think this behavior conflicts with the explanation in IBDAC-help (see below).
Here the text from IBDAC-Help
Class
TCustomIBCDataSet
Syntax
property AutoCommit: boolean;
Remarks
When True and Connection.AutoCommit is True, and Connection.InTransaction is False, each update, insert or delete statement is automatically committed by database server.
-----
The current behavior gives us problems in converting an IBO application to IBDAC, because in IBO, I always could rollback an explicitly started transaction independently from the setting of Autocommit.
Regards,
Josef Gschwendtner
Sorry, there is an mistake in the help. We'll fix it in the next IBDAC build.
IBDAC has such behaviour for compatibility with IBX.
You can try to use UniDAC instead of IBDAC. In UniDAC we have made the checking whether a transaction is started explicitly or implicitly, and disable AutoCommit automatically. In IBDAC you need to manually set AutoCommit of the connection component to False after you start a transaction.
IBDAC has such behaviour for compatibility with IBX.
You can try to use UniDAC instead of IBDAC. In UniDAC we have made the checking whether a transaction is started explicitly or implicitly, and disable AutoCommit automatically. In IBDAC you need to manually set AutoCommit of the connection component to False after you start a transaction.