23 lines
489 B
SQL
23 lines
489 B
SQL
/**
|
|
* Checks whether a passed queue number has valid sintax
|
|
*
|
|
* @param v_queue The queue to check format
|
|
* @return %TRUE if it's well formated
|
|
**/
|
|
DROP PROCEDURE IF EXISTS pbx.queueIsValid;
|
|
DELIMITER $$
|
|
CREATE PROCEDURE pbx.queueIsValid (vQueue VARCHAR(255))
|
|
BEGIN
|
|
DECLARE vIsValid BOOLEAN;
|
|
|
|
SET vIsValid = vQueue IS NULL
|
|
OR vQueue REGEXP '^[1-9][0-9]00$';
|
|
|
|
IF NOT vIsValid
|
|
THEN
|
|
SIGNAL SQLSTATE '45000'
|
|
SET MESSAGE_TEXT = 'QUEUE_INVALID_FORMAT';
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|