salix/db/routines/util/functions/formatRow.sql

22 lines
456 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`formatRow`(vType CHAR(3), vValues VARCHAR(512))
RETURNS varchar(512) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
DECLARE vRow VARCHAR(512);
IF vValues IS NOT NULL THEN
SET vRow = CONCAT('
<tr>
<td>', vType ,'</td>
<td>', REPLACE(vValues, ',', '</td><td>') ,'</td>
</tr>
');
ELSE
SET vRow = '';
END IF;
RETURN vRow;
END$$
DELIMITER ;