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

24 lines
545 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`formatTable`(vFields VARCHAR(512), vOldValues VARCHAR(512), vNewValues VARCHAR(512))
RETURNS text CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
DECLARE vTable TEXT;
SET vTable = CONCAT('
<table>
<thead><tr>
<th>type</th>
<th>', REPLACE(vFields, ',', '</th><th>') ,'
</tr></thead>
<tbody>
', formatRow('old', vOldValues) ,'
', formatRow('new', vNewValues) ,'
</tbody>
</table>
');
RETURN vTable;
END$$
DELIMITER ;