PDA

View Full Version : MYSQL transaction gets automited



polrus
2nd February 2017, 21:57
Hi,
I'm using mariaDB, and wanted to experiment with rollback

I have started db.transaction() -> returns true;

Then I declared a query and issues a query.prepare that should INSERT certain values to a table

I never called db.commit (removed all references to db.commit() from the code) but still the values from INSERT query get inserted when I execute query.exec()

and ideas?

adding db.rollback(); makes no change

jefftee
3rd February 2017, 01:48
Read the section regarding autocommit: https://mariadb.com/kb/en/mariadb/start-transaction/

polrus
3rd February 2017, 20:52
solved

the table has to be InnoDB - transactions wont run with MyISAM