7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
5 changed files with 27 additions and 20 deletions
Showing only changes of commit 791687f271 - Show all commits

View File

@ -4,6 +4,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `VN_SCHEDULER`
STARTS CURRENT_TIMESTAMP + INTERVAL 1 DAY
ENABLE
DO BEGIN
/**
* Ejecuta el PROCEDURE que comprueba si hay procedimientos planificados para ejecutar
*
*/
CALL `VN_SCHEDULER`();
END$$

View File

@ -1,20 +1,27 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`VN_SCHEDULER`()
BEGIN
/**
* Ejecuta los procedimientos que se han programado a demanda.
*
*/
DECLARE vDone BOOL;
DECLARE vError VARCHAR(255) DEFAULT NULL;
DECLARE vErrorCode VARCHAR(255) DEFAULT NULL;
DECLARE vSchema VARCHAR(255);
DECLARE vStatus VARCHAR(255);
DECLARE vProcedure VARCHAR(255);
-- DECLARE vLogMail VARCHAR(255);
DECLARE vScheduleFk INT;
-- Obtener datos de la tabla vn_schedules
DECLARE vQueue CURSOR FOR
SELECT id, `schema`, `procedure`, `status`
FROM vn_schedules
WHERE status = 'scheduled';
DECLARE EXIT HANDLER FOR SQLEXCEPTION
GET DIAGNOSTICS CONDITION 1
vError = MESSAGE_TEXT,
vErrorCode = RETURNED_SQLSTATE;
OPEN vQueue;
l: LOOP
SET vDone = FALSE;
@ -32,10 +39,7 @@ BEGIN
WHERE id = vScheduleFk;
SET vError = NULL;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
GET DIAGNOSTICS CONDITION 1
vError = MESSAGE_TEXT,
vErrorCode = RETURNED_SQLSTATE;
CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`'));
@ -55,14 +59,14 @@ BEGIN
UPDATE vn_schedules
SET `error` = vError,
finished = util.VN_NOW(),
lastFinished = util.VN_NOW()
`errorCode` = vErrorCode
lastFinished = util.VN_NOW(),
`errorCode` = vErrorCode,
`status` = 'error'
WHERE id = vScheduleFk;
ELSE
UPDATE vn_schedules
SET `error` = vError,
`errorCode` = vErrorCode
`errorCode` = vErrorCode,
finished = util.VN_NOW(),
lastFinished = util.VN_NOW(),
`status` = 'exec'

View File

@ -9,12 +9,11 @@ BEGIN
`changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId();
-- Activo el evento 'zone_getCollisions'
-- UPDATE `mysql`.`event` SET status = 1 WHERE name = 'zone_getCollisions';
-- Inserta en vn_schedules para ejecutar el procedure de 'zone_getCollisions'
INSERT IGNORE INTO `util`.`vn_schedules`(`schema`, `procedure`)
VALUES
(`vn`, `zone_getCollisions`);
('vn', 'zone_getCollisions');
-- Insert en vn_schedules 'zone_getCollisions'
END$$
DELIMITER ;

View File

@ -1,15 +1,15 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeInsert`
BEFORE INSERT ON `zoneIncluded`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
-- Activo el evento 'zone_getCollisions'
-- Insert en vn_schedulesla key 'zone_getCollisions'
-- ALTER EVENT zoneCollisions ENABLE;
-- Inserta en vn_schedules para ejecutar el procedure de 'zone_getCollisions'
INSERT IGNORE INTO `util`.`vn_schedules`(`schema`, `procedure`)
VALUES
(`vn`, `zone_getCollisions`);
('vn', 'zone_getCollisions');
END$$
DELIMITER ;

View File

@ -5,10 +5,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeUp
BEGIN
SET NEW.editorFk = account.myUser_getId();
-- Activo el evento 'zone_getCollisions' -- Insert en vn_schedules 'zone_getCollisions'
-- Inserta en vn_schedules para ejecutar el procedure de 'zone_getCollisions'
INSERT IGNORE INTO `util`.`vn_schedules`(`schema`, `procedure`)
VALUES
(`vn`, `zone_getCollisions`);
VALUES
('vn', 'zone_getCollisions');
END$$
DELIMITER ;