Rollback Transaction
Posted: Wed 01 Jul 2009 15:41
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;
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;