MySQL - How to check if START TRANSACTION is active
I have noticed that START TRANSACTION automatically COMMIT the previous queries. Because of this and the fact that I have several stored procedure called before the end of the whole transaction, I need to check if I am inside a START TRANSACTION or not. Reading the manual I understood that autocommit is set to false inside a START TRANSACTION , but it doesn't seem like this. I have written the following procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `test_transaction`() BEGIN show session variables like 'autocommit'; start transaction; show session variables like 'autocommit'; COMMIT;