salix/db/routines/account/functions/user_getNameFromId.sql

21 lines
416 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `account`.`user_getNameFromId`(vSelf INT)
RETURNS varchar(30) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
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 = vSelf;
RETURN vName;
END$$
DELIMITER ;