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)