Mercurial > urweb
diff src/monoize.sml @ 1572:5530a8075b62
IF THEN ELSE conditional for SQL.
author | Karn Kallio <kkallio@eka> |
---|---|
date | Fri, 14 Oct 2011 02:33:03 -0430 |
parents | f403e129c276 |
children | 34364e383bed |
line wrap: on
line diff
--- a/src/monoize.sml Sat Oct 08 17:23:58 2011 -0400 +++ b/src/monoize.sml Fri Oct 14 02:33:03 2011 -0430 @@ -2804,6 +2804,31 @@ fm) end + | (L.ECApp ( + (L.ECApp ( + (L.ECApp ( + (L.ECApp ( + (L.EFfi ("Basis", "sql_if_then_else"), _), _), + _), _), + _), _), + _), _)) => + let + val s = (L'.TFfi ("Basis", "string"), loc) + fun sc s = (L'.EPrim (Prim.String s), loc) + in + ((L'.EAbs ("if", s, (L'.TFun (s, s), loc), + (L'.EAbs ("then", s, (L'.TFun (s, s), loc), + (L'.EAbs ("else", s, (L'.TFun (s, s), loc), + strcat [sc "(CASE WHEN (", + (L'.ERel 2, loc), + sc ") THEN (", + (L'.ERel 1, loc), + sc ") ELSE (", + (L'.ERel 0, loc), + sc ") END)"]), loc)), loc)), loc), + fm) + end + | L.ECApp ( (L.ECApp ( (L.ECApp (