2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_doCalc`()
|
2024-01-15 11:31:03 +00:00
|
|
|
proc: BEGIN
|
|
|
|
/**
|
|
|
|
* Recalculates the zones tree.
|
|
|
|
*/
|
|
|
|
DECLARE vIsChanged BOOL;
|
|
|
|
|
|
|
|
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
|
|
BEGIN
|
|
|
|
DO RELEASE_LOCK('vn.zoneGeo_doCalc');
|
|
|
|
RESIGNAL;
|
|
|
|
END;
|
|
|
|
|
|
|
|
IF !GET_LOCK('vn.zoneGeo_doCalc', 0) THEN
|
|
|
|
LEAVE proc;
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
SELECT isChanged INTO vIsChanged
|
|
|
|
FROM zoneGeoRecalc;
|
|
|
|
|
|
|
|
IF vIsChanged THEN
|
|
|
|
UPDATE zoneGeoRecalc SET isChanged = FALSE;
|
|
|
|
CALL vn.zoneGeo_calcTree;
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
DO RELEASE_LOCK('vn.zoneGeo_doCalc');
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|