Merge branch 'master' into 7524-WhereWithoutLimit
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Sergio De la torre 2024-10-07 06:08:37 +00:00
commit 129b70d8d1
2 changed files with 21 additions and 5 deletions

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_assign`(
vUserFk INT, vUserFk INT,
OUT vCollectionFk INT OUT vCollectionFk INT
) )
BEGIN BEGIN
/** /**
* Comprueba si existen colecciones libres que se ajustan * Comprueba si existen colecciones libres que se ajustan
* al perfil del usuario y le asigna la más antigua. * al perfil del usuario y le asigna la más antigua.
@ -45,6 +45,12 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Si hay colecciones sin terminar, sale del proceso -- Si hay colecciones sin terminar, sale del proceso
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime
@ -118,9 +124,19 @@ BEGIN
IF vCollectionFk IS NULL THEN IF vCollectionFk IS NULL THEN
CALL collection_new(vUserFk, vCollectionFk); CALL collection_new(vUserFk, vCollectionFk);
UPDATE `collection` START TRANSACTION;
SET workerFk = vUserFk
WHERE id = vCollectionFk; SELECT workerFk INTO vCollectionWorker
FROM `collection`
WHERE id = vCollectionFk FOR UPDATE;
IF vCollectionWorker IS NULL THEN
UPDATE `collection`
SET workerFk = vUserFk
WHERE id = vCollectionFk;
END IF;
COMMIT;
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -40,7 +40,7 @@ BEGIN
isTooLittle BOOL DEFAULT FALSE, isTooLittle BOOL DEFAULT FALSE,
isVip BOOL DEFAULT FALSE, isVip BOOL DEFAULT FALSE,
PRIMARY KEY (ticketFk, saleFk) PRIMARY KEY (ticketFk, saleFk)
) ENGINE = MEMORY; ); -- No memory
INSERT INTO tmp.sale_problems(ticketFk, INSERT INTO tmp.sale_problems(ticketFk,
saleFk, saleFk,