WHEN substring(lower(path),length(path)-3+1) = 'gif' THEN '<img src=\"images/icons/image.gif\" title=\"Download image\">'
WHEN substring(lower(path),length(path)-3+1) = 'tex' THEN '<img src=\"images/icons/tex.png\" title=\"Download TeX file\">'
WHEN substring(lower(path),length(path)-3+1) = 'sql' THEN '<img src=\"images/icons/sql.png\" title=\"Download SQL file\">'
+WHEN substring(lower(path),length(path)-3+1) = 'txt' THEN '<img src=\"images/icons/text.png\" title=\"Download text file\">'
ELSE '<img src=\"images/icons/download.gif\" title=\"download\">'
END
";