0

What is the proper way to check if we are in the middle of transaction in MySQL ?

I guess that using SELECT @@autocommit; is not the way to go ?

also something like this:

SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX WHERE TRX_MYSQL_THREAD_ID = CONNECTION_ID();

found in this post, didn't work.

Whirlwind
  • 14,286
  • 11
  • 68
  • 157
  • Try this one: https://stackoverflow.com/questions/26620966/mysql-5-5-getting-the-current-transaction-id. – Gordon Linoff Jul 04 '17 at 13:13
  • @GordonLinoff Actually no luck. Which example did you actually had in mind? – Whirlwind Jul 04 '17 at 13:50
  • One possible option to evaluate is: [https://stackoverflow.com/a/36840813](https://stackoverflow.com/a/36840813). `SET TRANSACTION without GLOBAL or SESSION is not permitted while there is an active transaction:`, see [13.3.6 SET TRANSACTION Syntax](https://dev.mysql.com/doc/refman/5.7/en/set-transaction.html). – wchiquito Jul 05 '17 at 09:06
  • I recommend you clean up the app code so that the question has an obvious answer. – Rick James Jul 08 '17 at 22:52

0 Answers0