comparison 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
comparison
equal deleted inserted replaced
1571:f403e129c276 1572:5530a8075b62
2802 (L'.ERel 0, loc), 2802 (L'.ERel 0, loc),
2803 sc " IS NULL)"]), loc), 2803 sc " IS NULL)"]), loc),
2804 fm) 2804 fm)
2805 end 2805 end
2806 2806
2807 | (L.ECApp (
2808 (L.ECApp (
2809 (L.ECApp (
2810 (L.ECApp (
2811 (L.EFfi ("Basis", "sql_if_then_else"), _), _),
2812 _), _),
2813 _), _),
2814 _), _)) =>
2815 let
2816 val s = (L'.TFfi ("Basis", "string"), loc)
2817 fun sc s = (L'.EPrim (Prim.String s), loc)
2818 in
2819 ((L'.EAbs ("if", s, (L'.TFun (s, s), loc),
2820 (L'.EAbs ("then", s, (L'.TFun (s, s), loc),
2821 (L'.EAbs ("else", s, (L'.TFun (s, s), loc),
2822 strcat [sc "(CASE WHEN (",
2823 (L'.ERel 2, loc),
2824 sc ") THEN (",
2825 (L'.ERel 1, loc),
2826 sc ") ELSE (",
2827 (L'.ERel 0, loc),
2828 sc ") END)"]), loc)), loc)), loc),
2829 fm)
2830 end
2831
2807 | L.ECApp ( 2832 | L.ECApp (
2808 (L.ECApp ( 2833 (L.ECApp (
2809 (L.ECApp ( 2834 (L.ECApp (
2810 (L.ECApp ( 2835 (L.ECApp (
2811 (L.EFfi ("Basis", "sql_nullable"), _), 2836 (L.EFfi ("Basis", "sql_nullable"), _),