Reputation: 6697
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)
Upvotes: 2
Views: 1476
Reputation: 211610
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.
Upvotes: 2