Feat(SQL, UI): Logic for Get-Many SQL Stored Procedures refactored to use Calc Stored Procedures and Dog Command Links page styling improved.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
|
||||
USE parts;
|
||||
|
||||
DROP PROCEDURE IF EXISTS parts.p_DOG_user_eval;
|
||||
DROP PROCEDURE IF EXISTS parts.p_DOG_calc_user;
|
||||
DROP PROCEDURE IF EXISTS parts.p_dog_user_eval;
|
||||
DROP PROCEDURE IF EXISTS parts.p_dog_calc_user;
|
||||
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE parts.p_DOG_calc_user (
|
||||
CREATE PROCEDURE parts.p_dog_calc_user (
|
||||
IN a_guid BINARY(36)
|
||||
, IN a_ids_user TEXT
|
||||
, IN a_get_inactive_user BIT
|
||||
@@ -18,17 +18,17 @@ BEGIN
|
||||
DECLARE v_id_permission INT;
|
||||
DECLARE v_time_start TIMESTAMP(6);
|
||||
DECLARE v_ids_row_delete VARCHAR(500);
|
||||
DECLARE v_code_type_error_bad_data VARCHAR(200);
|
||||
DECLARE v_code_type_error_bad_data VARCHAR(250);
|
||||
DECLARE v_id_type_error_bad_data INT;
|
||||
DECLARE v_code_error_permission VARCHAR(200);
|
||||
DECLARE v_code_type_error_no_permission VARCHAR(250);
|
||||
DECLARE v_id_permission_required INT;
|
||||
DECLARE v_priority_access_level_required INT;
|
||||
DECLARE v_priority_access_level_view INT;
|
||||
|
||||
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||
SET v_code_type_error_bad_data := (SELECT code FROM parts.CORE_Msg_Error_Type WHERE code = 'BAD_DATA');
|
||||
SET v_id_type_error_bad_data := (SELECT id_type FROM parts.CORE_Msg_Error_Type WHERE code = v_code_type_error_bad_data);
|
||||
SET v_code_error_permission := (SELECT code FROM parts.CORE_Msg_Error_Type WHERE id_type = 2);
|
||||
SET v_code_type_error_bad_data := (SELECT code FROM parts.CORE_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
|
||||
SET v_id_type_error_bad_data := (SELECT id_type FROM parts.CORE_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
|
||||
SET v_code_type_error_no_permission := (SELECT code FROM parts.CORE_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1);
|
||||
SET v_priority_access_level_view := (SELECT priority FROM parts.DOG_Access_Level WHERE code = 'VIEW' LIMIT 1);
|
||||
|
||||
CALL parts.p_core_validate_guid ( a_guid );
|
||||
@@ -38,6 +38,7 @@ BEGIN
|
||||
SET a_debug := IFNULL(a_debug, 0);
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'Arguments';
|
||||
SELECT
|
||||
a_guid
|
||||
, a_ids_user
|
||||
@@ -45,6 +46,14 @@ BEGIN
|
||||
, a_ids_permission
|
||||
, a_debug
|
||||
;
|
||||
SELECT 'Derived variables';
|
||||
SELECT
|
||||
v_code_type_error_bad_data
|
||||
, v_code_type_error_no_permission
|
||||
, v_id_type_error_bad_data
|
||||
, v_priority_access_level_view
|
||||
, v_time_start
|
||||
;
|
||||
END IF;
|
||||
|
||||
DROP TABLE IF EXISTS tmp_Calc_User;
|
||||
@@ -174,6 +183,10 @@ BEGIN
|
||||
END IF;
|
||||
DELETE FROM tmp_Split_Calc_User;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT v_id_permission_required;
|
||||
END IF;
|
||||
|
||||
-- Users
|
||||
CALL parts.p_core_split(a_guid, a_ids_user, ',', a_debug);
|
||||
|
||||
@@ -247,6 +260,17 @@ BEGIN
|
||||
AND AL_U.active
|
||||
GROUP BY U.id_user
|
||||
;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT
|
||||
t_UCU.id_user
|
||||
, v_id_permission_required
|
||||
, v_priority_access_level_required
|
||||
, t_UCU.priority_access_level AS priority_access_level_user
|
||||
, t_UCU.is_super_user AS is_super_user
|
||||
FROM tmp_User_Calc_User t_UCU
|
||||
;
|
||||
END IF;
|
||||
|
||||
INSERT INTO tmp_Calc_User (
|
||||
id_user
|
||||
@@ -306,7 +330,7 @@ BEGIN
|
||||
SELECT * FROM tmp_Calc_User;
|
||||
SELECT * FROM tmp_User_Calc_User;
|
||||
SELECT * FROM parts.DOG_Calc_User_Temp WHERE GUID = a_guid;
|
||||
CALL parts.p_DOG_clear_calc_user ( a_guid, a_debug );
|
||||
CALL parts.p_dog_clear_calc_user ( a_guid, a_debug );
|
||||
END IF;
|
||||
|
||||
-- Clean up
|
||||
@@ -322,7 +346,7 @@ DELIMITER ;
|
||||
|
||||
/*
|
||||
|
||||
CALL parts.p_DOG_calc_user (
|
||||
CALL parts.p_dog_calc_user (
|
||||
'chips ' -- a_guid
|
||||
, 1 -- a_ids_user
|
||||
, 0 -- a_get_inactive_user
|
||||
@@ -330,7 +354,7 @@ CALL parts.p_DOG_calc_user (
|
||||
, '1' -- a_ids_access_level
|
||||
, 0 -- a_debug
|
||||
);
|
||||
CALL parts.p_DOG_calc_user (
|
||||
CALL parts.p_dog_calc_user (
|
||||
'chips ' -- a_guid
|
||||
, 1 -- a_ids_user
|
||||
, 0 -- a_get_inactive_user
|
||||
@@ -338,4 +362,15 @@ CALL parts.p_DOG_calc_user (
|
||||
, '1' -- a_ids_access_level
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
|
||||
DELETE FROM demo.DOG_Calc_User_Temp;
|
||||
CALL demo.p_dog_calc_user (
|
||||
'chips ' -- a_guid
|
||||
, 1 -- a_ids_user
|
||||
, 0 -- a_get_inactive_user
|
||||
, '7' -- a_ids_permission
|
||||
, 0 -- a_debug
|
||||
);
|
||||
SELECT * FROM demo.DOG_Calc_User_Temp;
|
||||
*/
|
||||
Reference in New Issue
Block a user