Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
393cabac
authored
Apr 21, 2017
by
Jose Antonio
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
trigger enrolment - picto core
parent
89628470
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
sails/roles/database/files/triggers-enrolments-integrity-constraints.sql
sails/roles/database/files/triggers-enrolments-integrity-constraints.sql
View file @
393cabac
...
...
@@ -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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment