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

21 lines
400 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
WHERE id = vId;
RETURN vSelf;
END$$
DELIMITER ;