Problems with autocommit mode

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
jpgonzalez
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 31.03.2013, 21:07

Problems with autocommit mode

Post by jpgonzalez »

I use ZConnection with de autocommit = true
I Have this code:

try
DmMain.ZConnection.StartTransaction;
................
DmOperacionesVehiculos.QryInsertarVehiculo.ExecSQL;
................
................
DmOperacionesVehiculos.QryGuardarOperacion.ExecSQL;
................
DmOperacionesVehiculos.QryGuardarBoleto.ExecSQL;
................
................
DmMain.ZConnection.Commit;
ShowMessage('La operacion de compra se ha guardado con exito');
except
DmMain.ZConnection.Rollback;
ShowMessage('No se pudo guardar la compra');
end;

When I have a problem in the second query (QryGuardarOperacion), Rollback don´t work correctly, because the first query (QryInsertarVehiculo) post the data in the BD, despite i use startTransaction.
This problem creates inconsistency in the database, because the vehicle is post, but not the other information.
I don´t know if this is a bug of the Zeos version.
When I use the autocommit = false, the data is not post in the BD despite I use the commit command.


After that, I tested putting autocommit = false, without the command StartTransaction
This was running the entire block of code perfectly, but the data is not stored in the database.
I could see the data in the program, but not in the database, as if making a post in memory.

I do not know what happens, but in both cases (autocommit = autocommit = true and false) bring me any problems.

Can you tell me what can I do?
The Zeos Version is = 7.0.0-dev

PD: sorry for my english...
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Post by marsupilami »

Hello jpgonzalez,

could you please check wether this also happens in the current stable version 7.0.3?
Best regards,

Jan
jpgonzalez
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 31.03.2013, 21:07

Post by jpgonzalez »

marsupilami wrote:Hello jpgonzalez,

could you please check wether this also happens in the current stable version 7.0.3?
Best regards,

Jan
I installed the version 7.0.3-stable, and I still get the same error.
I do not understand that part of the code inserted in a block StartTransaction / Commit.
Be a problem of try / except???

Thanks!!!!
jpgonzalez
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 31.03.2013, 21:07

Post by jpgonzalez »

I found the solucoin in www.clubdelphi.com/foros
Had to put TRansactIsolationLevel = readCommited

Thanks anyway!!!
Post Reply