mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 02:57:36 +00:00
Edit button locate, delete, group header
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Benchmark_Delete`(IN p_id_benchmark CHAR(36))
|
||||
BEGIN
|
||||
-- Remove progress-event/benchmark associations
|
||||
DELETE FROM progress_event_benchmark
|
||||
WHERE id_benchmark = p_id_benchmark;
|
||||
-- Remove the benchmark itself
|
||||
DELETE FROM benchmark
|
||||
WHERE id_benchmark = p_id_benchmark;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
@@ -0,0 +1,22 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_Delete`(IN p_id_goal CHAR(36))
|
||||
BEGIN
|
||||
-- Remove benchmark/event associations for progress events under this goal
|
||||
DELETE peb FROM progress_event_benchmark peb
|
||||
INNER JOIN progress_event pe ON pe.id_progress_event = peb.id_progress_event
|
||||
WHERE pe.id_goal = p_id_goal;
|
||||
-- Remove progress events under this goal
|
||||
DELETE FROM progress_event
|
||||
WHERE id_goal = p_id_goal;
|
||||
-- Remove benchmarks under this goal
|
||||
DELETE FROM benchmark
|
||||
WHERE id_goal = p_id_goal;
|
||||
-- Remove child goals (one level)
|
||||
DELETE FROM goal
|
||||
WHERE id_goal_parent = p_id_goal;
|
||||
-- Remove the goal itself
|
||||
DELETE FROM goal
|
||||
WHERE id_goal = p_id_goal;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
@@ -0,0 +1,12 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ProgressEvent_Delete`(IN p_id_progress_event CHAR(36))
|
||||
BEGIN
|
||||
-- Remove benchmark associations
|
||||
DELETE FROM progress_event_benchmark
|
||||
WHERE id_progress_event = p_id_progress_event;
|
||||
-- Remove the progress event itself
|
||||
DELETE FROM progress_event
|
||||
WHERE id_progress_event = p_id_progress_event;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
@@ -4,7 +4,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_Delete`(
|
||||
)
|
||||
BEGIN
|
||||
DELETE FROM `ReportPrompt`
|
||||
WHERE `id_report_prompt` = p_id_report_prompt;
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt;
|
||||
SELECT ROW_COUNT() AS rowsAffected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -2,7 +2,7 @@ DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_GetAll`()
|
||||
BEGIN
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
|
||||
@@ -4,12 +4,12 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_GetById`(
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
FROM `ReportPrompt`
|
||||
WHERE `id_report_prompt` = p_id_report_prompt
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt
|
||||
LIMIT 1;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -5,7 +5,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_GetByReportname`(
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
|
||||
@@ -8,7 +8,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_Insert`(
|
||||
BEGIN
|
||||
INSERT INTO `ReportPrompt`
|
||||
(
|
||||
`id_report_prompt`,
|
||||
`id_ReportPrompt`,
|
||||
`id_program`,
|
||||
`prompt`,
|
||||
`reportname`
|
||||
@@ -21,12 +21,12 @@ BEGIN
|
||||
p_reportname
|
||||
);
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
FROM `ReportPrompt`
|
||||
WHERE `id_report_prompt` = p_id_report_prompt
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt
|
||||
LIMIT 1;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -7,9 +7,9 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_Update`(
|
||||
BEGIN
|
||||
UPDATE `ReportPrompt`
|
||||
SET
|
||||
`prompt` = p_prompt,
|
||||
`reportname` = p_reportname
|
||||
WHERE `id_report_prompt` = p_id_report_prompt;
|
||||
`prompt` = COALESCE(p_prompt, `prompt`),
|
||||
`reportname` = COALESCE(p_reportname, `reportname`)
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt;
|
||||
SELECT ROW_COUNT() AS rowsAffected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_Delete`(IN p_id_student CHAR(36))
|
||||
BEGIN
|
||||
-- Remove progress-event/benchmark associations
|
||||
DELETE peb FROM progress_event_benchmark peb
|
||||
INNER JOIN progress_event pe ON pe.id_progress_event = peb.id_progress_event
|
||||
INNER JOIN goal g ON g.id_goal = pe.id_goal
|
||||
WHERE g.id_student = p_id_student;
|
||||
-- Remove progress events
|
||||
DELETE pe FROM progress_event pe
|
||||
INNER JOIN goal g ON g.id_goal = pe.id_goal
|
||||
WHERE g.id_student = p_id_student;
|
||||
-- Remove benchmarks
|
||||
DELETE b FROM benchmark b
|
||||
INNER JOIN goal g ON g.id_goal = b.id_goal
|
||||
WHERE g.id_student = p_id_student;
|
||||
-- Remove goals
|
||||
DELETE FROM goal
|
||||
WHERE id_student = p_id_student;
|
||||
-- Remove user-student associations
|
||||
DELETE FROM user_student
|
||||
WHERE id_student = p_id_student;
|
||||
-- Remove the student
|
||||
DELETE FROM student
|
||||
WHERE id_student = p_id_student;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
|
||||
Reference in New Issue
Block a user