Just a quick sample in MSSQL first to show my point.
So in this instance @@ERROR catches ANY possible associated errors with the first
update statment, if any exist the statement is rolled back but if it is squeaky
clean then we head on to the next statement. How do I achieve this kind of
cascading block check in MySQL, I mean what is the equivalent of @@ERROR that
I can wrap in conditional statements?
Code:
BEGIN TRANSACTION
UPDATE tblFoo set a = 1
IF @@ERROR <> 0
BEGIN
RETURN 1
ROLLBACK TRANSACTION
END
ELSE
BEGIN
UPDATE tblBar set b = 2
IF @@ERROR <> 0
BEGIN
RETURN 1
ROLLBACK TRANSACTION
END
ELSE
BEGIN
RETURN 1
COMMIT TRANSACTION
END
END
END
So in this instance @@ERROR catches ANY possible associated errors with the first
update statment, if any exist the statement is rolled back but if it is squeaky
clean then we head on to the next statement. How do I achieve this kind of
cascading block check in MySQL, I mean what is the equivalent of @@ERROR that
I can wrap in conditional statements?