17 lines
489 B
MySQL
17 lines
489 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` 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 ;
|