Commit 393cabac by Jose Antonio

trigger enrolment - picto core

parent 89628470
......@@ -41,6 +41,7 @@ CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS
AFTER INSERT ON student
FOR EACH ROW
thisTrigger: BEGIN
DECLARE LID INT;
IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE))
AND (USER() = 'root@localhost')
......@@ -48,9 +49,22 @@ thisTrigger: BEGIN
LEAVE thisTrigger;
END IF;
-- Load core collection for student
INSERT INTO stu_picto(id_stu,id_pic,attributes)
SELECT new.id,id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null', id_cat_pic),
INSERT INTO scene (id_stu,id_sup,name,active,categories) VALUES (new.id, null, 'with_categories', TRUE, TRUE);
SET LID = LAST_INSERT_ID();
CALL scene_create_core(LID,new.id);
END;;
-- Procedure to add core when new scene is created
DROP PROCEDURE IF EXISTS scene_create_core ;
CREATE PROCEDURE scene_create_core(IN id_scene INTEGER, IN id_stu INTEGER)
BEGIN
-- Load core collection for student
INSERT INTO stu_picto(id_stu,id_pic,id_scene,attributes)
SELECT id_stu,id_pic,id_scene, concat('{"id_cat":', if (id_cat_pic is null, 'null', id_cat_pic),
',"coord_x":',coord_x,
',"coord_y":',coord_y,
',"status":"invisible"',
......@@ -84,3 +98,5 @@ thisTrigger: BEGIN
END IF;
END IF;
END;;
DELIMITER ;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment