fix: refs #6861 fixTransactionCommit #3139

Merged
sergiodt merged 1 commits from 6861-Reservas into master 2024-10-22 08:13:01 +00:00
2 changed files with 34 additions and 33 deletions
Showing only changes of commit 6ef7760498 - Show all commits

View File

@ -20,6 +20,7 @@ proc: BEGIN
DECLARE vUserFk INT;
DECLARE vTotalReservedQuantity INT;
DECLARE vSaleQuantity INT;
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
DECLARE vItemShelvingAvailable CURSOR FOR
SELECT ish.id itemShelvingFk,
@ -44,11 +45,11 @@ proc: BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
CALL util.tx_rollback(vIsRequiredTx);
RESIGNAL;
END;
START TRANSACTION;
CALL util.tx_start(vIsRequiredTx);
SELECT id INTO vSaleFk
FROM sale
@ -65,7 +66,7 @@ proc: BEGIN
WHERE s.id = vSaleFk;
IF vOutStanding <= 0 THEN
COMMIT;
CALL util.tx_commit(vIsRequiredTx);
LEAVE proc;
END IF;
@ -123,6 +124,6 @@ proc: BEGIN
END IF;
END LOOP;
CLOSE vItemShelvingAvailable;
COMMIT;
CALL util.tx_commit(vIsRequiredTx);
END$$
DELIMITER ;