Mercurial > hg > orthanc-databases
comparison MySQL/Plugins/DeleteResources.sql @ 521:2ab3d45c0b3c large-queries
merge default -> large-queries
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 04 Jul 2024 07:44:39 +0200 |
parents | d0dd95ff0662 |
children |
comparison
equal
deleted
inserted
replaced
501:594859656a06 | 521:2ab3d45c0b3c |
---|---|
1 DROP PROCEDURE IF EXISTS DeleteResources; | |
2 | |
3 CREATE PROCEDURE DeleteResources( | |
4 IN p_id BIGINT | |
5 ) | |
6 BEGIN | |
7 DECLARE v_internalId BIGINT@ | |
8 DECLARE done INT DEFAULT FALSE@ | |
9 DECLARE cur1 CURSOR FOR | |
10 SELECT internalId FROM DeletedResources@ | |
11 DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = TRUE@ | |
12 set done=FALSE@ | |
13 | |
14 OPEN cur1@ | |
15 REPEAT | |
16 FETCH cur1 INTO v_internalId@ | |
17 IF NOT done THEN | |
18 DELETE FROM Resources WHERE internalId=v_internalId@ | |
19 END IF@ | |
20 UNTIL done END REPEAT@ | |
21 CLOSE cur1@ | |
22 | |
23 END; |