31 lines
494 B
MySQL
31 lines
494 B
MySQL
|
USE `util`;
|
||
|
DROP procedure IF EXISTS `procNoOverlap`;
|
||
|
|
||
|
DELIMITER $$
|
||
|
USE `util`$$
|
||
|
CREATE PROCEDURE `procNoOverlap` (procName VARCHAR(255))
|
||
|
SQL SECURITY INVOKER
|
||
|
proc: BEGIN
|
||
|
/**
|
||
|
* call procedure without overlap
|
||
|
*/
|
||
|
DECLARE vIsChanged BOOL;
|
||
|
|
||
|
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
||
|
BEGIN
|
||
|
DO RELEASE_LOCK(procName);
|
||
|
RESIGNAL;
|
||
|
END;
|
||
|
|
||
|
IF !GET_LOCK(procName, 0) THEN
|
||
|
LEAVE proc;
|
||
|
END IF;
|
||
|
|
||
|
CALL exec(CONCAT('CALL ', procName));
|
||
|
|
||
|
DO RELEASE_LOCK(procName);
|
||
|
END$$
|
||
|
|
||
|
DELIMITER ;
|
||
|
|