I have multiple MySQL InnoDb tables, I am trying to alter/insert/modify many of them in a SQL transaction, I set autocommit
to false, so that if some SQL statements fail, I do commit the rest of statements:
set autocommit = 0;
START TRANSACTION;
use database1;
update `table1` set tkey = '3' .....;
update `table1` set tkey = '4' .......;
update `table1` set tkey = '5' .......;
update `table1` set tkey = '6' .......;
ALTER TABLE `table2` ADD COLUMN `.....` bool NOT NULL; -- This fails
COMMIT;
In above transaction the alter
against table2 fails, but still the updates to table 1 have happened, how can I avoid that? I want a rollback even if one statement fails.