19 lines
497 B
MySQL
19 lines
497 B
MySQL
|
DROP PROCEDURE IF EXISTS account.role_checkName;
|
||
|
|
||
|
DELIMITER $$
|
||
|
CREATE 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 ;
|