Skip to content

Instantly share code, notes, and snippets.

@yfuruyama
Created April 17, 2014 14:44
Show Gist options
  • Select an option

  • Save yfuruyama/10988909 to your computer and use it in GitHub Desktop.

Select an option

Save yfuruyama/10988909 to your computer and use it in GitHub Desktop.
[InnoDB] check if current thread is in transaction
DELIMITER //
CREATE PROCEDURE intrx()
BEGIN
SELECT COUNT(*) as in_trx FROM information_schema.innodb_trx WHERE trx_mysql_thread_id = (SELECT connection_id());
END;
//
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment