Erro starting a transaction and autocommit disable

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
llutti
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 08.07.2016, 17:55

Erro starting a transaction and autocommit disable

Post by llutti »

Hi,

I create a new form and put a TZConnection. Change the property AutoCommit to false.

When I try to start a transaction occurs this error:

Code: Select all

ZConnection1.StartTransaction;
[Debugger Exception Notification]

Project projectSqlDB raised exception class 'EZDatabaseError' with message:
Invalid operation in non AutoCommit mode

In file 'C:\lazarus\zeosdb\src\component\ZAbstractConnection.pas' at line 959:
raise EZDatabaseError.Create(SInvalidOpInNonAutoCommit);
To solve this problem I change the procedure TZAbstractConnection.StartTransaction to this:

Code: Select all

procedure TZAbstractConnection.StartTransaction;
begin
//  CheckAutoCommitMode; // llutti comment
  if FExplicitTransactionCounter = 0 then
    AutoCommit := False;
  DoStartTransaction;
  Inc(FExplicitTransactionCounter);

  CheckAutoCommitMode; // llutti moved
end; 
I don't now if this is the correct solution, but it works.

I Using Lazarus 1.7 and Zeos 7.2beta.

Regards,

Luciano
Post Reply