I'm using InnoDB 5.6.35, and I have a question regarding the correct way to implement MySQL transaction. If I implement the following send it to MySQL in one statement:
START TRANSACTION;
SQL-Statement 1; SQL-Statement 2; ... COMMIT;
Question: Does MySQL automatically issues the Rollback if one of the SQL statements fails? The behavior I've seen is that it looks like MySQL does not commit with the above statements when it encounters a failed operation (even Rollback is not called in my program), but I am not too sure after reading some postings. Do I have to wrap the codes in a stored procedure as suggested by others, and call "Rollback" explicitly in my code?
Can someone help me to clarify this?