DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `account`.`myUser_getName`()
	RETURNS varchar(30) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
	DETERMINISTIC
	NO SQL
BEGIN
/**
 * Returns the current user name.
 *
 * @return The user name
 */
	DECLARE vUser VARCHAR(30) DEFAULT NULL;

	IF myUser_checkLogin()
    THEN
		SET vUser = @userName;
	ELSE
		SET vUser = LEFT(USER(), INSTR(USER(), '@') - 1);
	END IF;
	
	RETURN vUser;
END$$
DELIMITER ;
