1

Based on this question and this paragraph of the documentation:

For transactional tables, failure of a statement should cause rollback of all changes performed by the statement. Failure of a trigger causes the statement to fail, so trigger failure also causes rollback. For nontransactional tables, such rollback cannot be done, so although the statement fails, any changes performed prior to the point of the error remain in effect.

I figured out if my table is transactional then both the query and triggers will be depends on each other. I mean either both query and trigger will be successful or none of them.

So how can I detect my table is transaction or lock? Noted that I'm using MySQL, InnoDB engine and PDO (if this is important to know)

Community
  • 1
  • 1
Martin AJ
  • 6,261
  • 8
  • 53
  • 111
  • InnoDB tables are transactional tables. Non-transactional tables would be e.g MyISAM. Locks are related to transactions, but work on both types, so I'm not exactly sure what you mean by that. – Solarflare Jun 10 '16 at 15:57

1 Answers1

2

You can find out the type of table you're using either via SHOW CREATE TABLE for any individual one and look for the ENGINE parameter, or use SHOW TABLE STATUS and look at the Engine column.

InnoDB supports transactions. MyISAM, the legacy MySQL engine, doesn't.

You should also test your assumptions on whatever systems are important to you. Just because you're using a particular engine locally doesn't mean that's how it's been deployed, the server default might be different.

tadman
  • 208,517
  • 23
  • 234
  • 262