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
c0ebcc93
authored
Oct 24, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
adding begin end dates to instructions
parent
5e8dadf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
sails/roles/database/files/triggers-sessions-integrity-constraints.sql
sails/roles/database/files/triggers-sessions-integrity-constraints.sql
View file @
c0ebcc93
...
@@ -89,7 +89,9 @@ thisTrigger: BEGIN
...
@@ -89,7 +89,9 @@ thisTrigger: BEGIN
NOW
(
3
)
NOW
(
3
)
)
)
ON
DUPLICATE
KEY
UPDATE
id_stu
=
idstu
,
id_sup
=
idsup
,
id_ws
=
NEW
.
id_ws
,
id_opentry
=
NEW
.
id
;
ON
DUPLICATE
KEY
UPDATE
id_stu
=
idstu
,
id_sup
=
idsup
,
id_ws
=
NEW
.
id_ws
,
id_opentry
=
NEW
.
id
;
END
;;
END
;;
--
--
-- It deletes current try for a given session
-- It deletes current try for a given session
DROP
PROCEDURE
IF
EXISTS
deleteOpenTry
;
DROP
PROCEDURE
IF
EXISTS
deleteOpenTry
;
...
@@ -117,6 +119,7 @@ AFTER INSERT ON working_session
...
@@ -117,6 +119,7 @@ AFTER INSERT ON working_session
FOR
EACH
ROW
FOR
EACH
ROW
thisTrigger
:
BEGIN
thisTrigger
:
BEGIN
DECLARE
idstu
INT
;
DECLARE
idstu
INT
;
DECLARE
ins_begin
DATE
;
IF
((
@
TRIGGER_CHECKS
=
FALSE
)
IF
((
@
TRIGGER_CHECKS
=
FALSE
)
OR
(
@
TRIGGER_AFTER_INSERT_CHECKS
=
FALSE
))
OR
(
@
TRIGGER_AFTER_INSERT_CHECKS
=
FALSE
))
...
@@ -125,9 +128,25 @@ thisTrigger: BEGIN
...
@@ -125,9 +128,25 @@ thisTrigger: BEGIN
LEAVE
thisTrigger
;
LEAVE
thisTrigger
;
END
IF
;
END
IF
;
UPDATE
instruction
SELECT
begin
INTO
ins_begin
SET
status
=
'started'
FROM
instruction
WHERE
id
=
new
.
id_ins
;
WHERE
id
=
NEW
.
id_ins
IF
(
ins_begin
IS
NULL
)
THEN
UPDATE
instruction
SET
begin
=
NOW
(
3
),
end
=
NOW
(
3
)
WHERE
id
=
NEW
.
id_ins
END
IF
;
UPDATE
instruction
SET
status
=
'started'
,
end
=
NOW
(
3
)
WHERE
id
=
NEW
.
id_ins
;
INSERT
INTO
try
(
`id_ws`
)
INSERT
INTO
try
(
`id_ws`
)
VALUES
(
new
.
id
);
VALUES
(
new
.
id
);
...
@@ -150,6 +169,16 @@ thisTrigger: BEGIN
...
@@ -150,6 +169,16 @@ thisTrigger: BEGIN
LEAVE
thisTrigger
;
LEAVE
thisTrigger
;
END
IF
;
END
IF
;
-- end date for related instruction is updated
IF
(
OLD
.
end
<
NEW
.
end
)
THEN
UPDATE
instruction
SET
end
=
NEW
.
end
WHERE
id
=
NEW
.
id_ins
END
IF
;
-- remove open try
IF
((
old
.
end
IS
NULL
)
and
(
new
.
end
IS
NOT
NULL
))
THEN
IF
((
old
.
end
IS
NULL
)
and
(
new
.
end
IS
NOT
NULL
))
THEN
CALL
deleteOpenTry
(
new
.
id
);
CALL
deleteOpenTry
(
new
.
id
);
END
IF
;
END
IF
;
...
@@ -335,6 +364,8 @@ thisTrigger: BEGIN
...
@@ -335,6 +364,8 @@ thisTrigger: BEGIN
WHERE
id
=
NEW
.
id_ws
;
WHERE
id
=
NEW
.
id_ws
;
END
IF
;
END
IF
;
END
;;
END
;;
...
...
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