salix/db/changes/10221-accountModule/00-role_checkName.sql

19 lines
516 B
SQL

DROP PROCEDURE IF EXISTS account.role_checkName;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE account.role_checkName(vRoleName VARCHAR(255))
BEGIN
/**
* Checks that role name meets the necessary syntax requirements, otherwise it
* throws an exception.
* Role name must be written in camelCase.
*
* @param vRoleName The role name
*/
IF BINARY vRoleName NOT REGEXP '^[a-z][a-zA-Z]+$' THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Role name must be written in camelCase';
END IF;
END$$
DELIMITER ;