Invalid operation in AutocommitMode
Posted: 18.05.2008, 17:45
hi all
my instalation: laz 0.9.24 beta and zeos 6.6.2 (under MS Vista)
i'm using firebird db server (not embedded) and i've already looked in this site about this topic... however i think there's something strange
i know using firebird, working with AutocommitMode = TRUE is good; i know too that StartTransaction escape from this setting and allow to work in "OFF MODE" until a commit or rollback explicit invocation.
so i use this code:
procedure TForm1.ExecuteSqlScript;
var sApp: string;
begin
sApp := 'script.sql';
if Memo1.Lines.Count = 0 then
Memo1.Lines.LoadFromFile(sApp);
ZSQLProcessor1.Script.Assign(Memo1.Lines);
cnConn.StartTransaction;
Try
ZSQLProcessor1.Execute;
Except
on e: exception do begin
Memo2.Lines.Add('error: ' + e.Message);
Memo2.Lines.Add(' rollback forced');
cnConn.Rollback;
Memo2.Lines.Add(' rollback done');
end;
End;
cnConn.Commit;
end;
the code above is ok but i can't avoid to the end user a "Invalid operation inAutocommit mode" message
i come from delphi and i've recently started using lazarus with zeos... so is that a zeos bug or a my-source-bug?
thanks
markbass72
my instalation: laz 0.9.24 beta and zeos 6.6.2 (under MS Vista)
i'm using firebird db server (not embedded) and i've already looked in this site about this topic... however i think there's something strange
i know using firebird, working with AutocommitMode = TRUE is good; i know too that StartTransaction escape from this setting and allow to work in "OFF MODE" until a commit or rollback explicit invocation.
so i use this code:
procedure TForm1.ExecuteSqlScript;
var sApp: string;
begin
sApp := 'script.sql';
if Memo1.Lines.Count = 0 then
Memo1.Lines.LoadFromFile(sApp);
ZSQLProcessor1.Script.Assign(Memo1.Lines);
cnConn.StartTransaction;
Try
ZSQLProcessor1.Execute;
Except
on e: exception do begin
Memo2.Lines.Add('error: ' + e.Message);
Memo2.Lines.Add(' rollback forced');
cnConn.Rollback;
Memo2.Lines.Add(' rollback done');
end;
End;
cnConn.Commit;
end;
the code above is ok but i can't avoid to the end user a "Invalid operation inAutocommit mode" message
i come from delphi and i've recently started using lazarus with zeos... so is that a zeos bug or a my-source-bug?
thanks
markbass72