Is it possible to somehow determine that after the last INSERT / DELETE / UPDATE operation an error occurred to make a conditional rollback of an operation in a transaction?
For example, in MS SQL Server for this task, you can use the system variable @@ERROR , which takes a nonzero value when an error occurs after the last operation. Here is its usage:
BEGIN TRANSACTION INSERT INTO Customers(cust_id, cust_name) VALUES('1000000010', 'Toys Emporium'); SAVE TRANSACTION StartOrder; INSERT INTO Orders(order_num, order_date, cust_id) VALUES(20100,'2001/12/1','1000000010'); IF @@ERROR <> 0 ROLLBACK TRANSACTION StartOrder; Is it possible to implement something similar for MySQL? PS: I do not use PHP.
Можно ли реализовать что-то подобное для MySQL?Of course. For this there is a CREATE HANDLER. - Akina