I\'m working with a very complex codebase and wish to do some introspection of how it works with MySQL. (Note that I\'m using InnoDB).
Specifically, in a method I\'
This is a pretty interesting question. I don't think there is a definite way to determine if issuing commit will or will not make a difference in the session you are running.
You can see transactions with show innodb status
or show engine innodb status but I don't think you can issue commit on those transactions.
INNODB_TRX
table in information_schema will show currently executing transations: https://dev.mysql.com/doc/refman/5.5/en/innodb-trx-table.html and again there's not much you can do to force-commit them. You can roll them back by killing the associated process.
If you are running a transaction using START TRANSACTION in a stored procedure, you can handle commit and rollback manually. You can even set autocommit to 0 to control when to rollback and when to commit.