2024-05-02 15:05:10 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblemByClient`(
|
|
|
|
vClientFk INT
|
|
|
|
)
|
|
|
|
proc: BEGIN
|
|
|
|
/**
|
2024-05-02 16:13:12 +00:00
|
|
|
* Update the problem of all client tickets whose client is frozen or unfrozen
|
|
|
|
* @param vClientFk Id client
|
2024-05-02 15:05:10 +00:00
|
|
|
*/
|
|
|
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
|
|
|
(INDEX(ticketFk))
|
|
|
|
ENGINE = MEMORY
|
|
|
|
SELECT t.id ticketFk, FALSE hasProblem
|
|
|
|
FROM ticket t
|
|
|
|
WHERE t.clientFk = vClientFk
|
|
|
|
AND t.shipped >= util.midnight();
|
|
|
|
|
|
|
|
CALL ticket_getFreezeProblem();
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE tmp.ticket;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|