Page 1 of 1

Erro starting a transaction and autocommit disable

Posted: 08.07.2016, 18:56
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