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

21 lines
402 B
MySQL
Raw Normal View History

DROP FUNCTION IF EXISTS account.user_getNameFromId;
DELIMITER $$
CREATE DEFINER=`root`@`%` FUNCTION `account`.`user_getNameFromId`(vSelf INT) RETURNS varchar(30) CHARSET utf8
BEGIN
/**
* Gets user name from it's id.
*
* @param vSelf The user id
* @return The user name
*/
DECLARE vName VARCHAR(30);
SELECT `name` INTO vName
FROM user
2020-09-28 19:25:53 +00:00
WHERE id = vSelf;
2020-09-28 19:25:53 +00:00
RETURN vName;
END$$
DELIMITER ;