diff options
author | 2010-04-01 17:21:16 -0400 | |
---|---|---|
committer | 2010-04-01 17:21:16 -0400 | |
commit | 0711137eb49ee22f30f8201d90f1a594f7d0b190 (patch) | |
tree | 640b653b8f73d907847dbf5887f47484ce9f0255 /src/monoize.sml | |
parent | cac2d6fee4af04686a9c39750e306140a0369f4c (diff) |
Relational operators portability
Diffstat (limited to 'src/monoize.sml')
-rw-r--r-- | src/monoize.sml | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 9799ae95..25ea87f5 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -2403,16 +2403,26 @@ fun monoExp (env, st, fm) (all as (e, loc)) = val s = (L'.TFfi ("Basis", "string"), loc) fun sc s = (L'.EPrim (Prim.String s), loc) in - ((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), - (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), - (L'.EAbs ("e2", s, s, - strcat [sc "((", - (L'.ERel 1, loc), - sc ") ", - (L'.ERel 2, loc), - sc " (", - (L'.ERel 0, loc), - sc "))"]), loc)), loc)), loc), + (if #nestedRelops (Settings.currentDbms ()) then + (L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), + (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), + (L'.EAbs ("e2", s, s, + strcat [sc "((", + (L'.ERel 1, loc), + sc ") ", + (L'.ERel 2, loc), + sc " (", + (L'.ERel 0, loc), + sc "))"]), loc)), loc)), loc) + else + (L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), + (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), + (L'.EAbs ("e2", s, s, + strcat [(L'.ERel 1, loc), + sc " ", + (L'.ERel 2, loc), + sc " ", + (L'.ERel 0, loc)]), loc)), loc)), loc), fm) end | L.ECApp ( @@ -2433,8 +2443,18 @@ fun monoExp (env, st, fm) (all as (e, loc)) = end | L.EFfi ("Basis", "sql_union") => ((L'.EPrim (Prim.String "UNION"), loc), fm) - | L.EFfi ("Basis", "sql_intersect") => ((L'.EPrim (Prim.String "INTERSECT"), loc), fm) - | L.EFfi ("Basis", "sql_except") => ((L'.EPrim (Prim.String "EXCEPT"), loc), fm) + | L.EFfi ("Basis", "sql_intersect") => + (if #onlyUnion (Settings.currentDbms ()) then + ErrorMsg.errorAt loc "The DBMS you've selected doesn't support INTERSECT." + else + (); + ((L'.EPrim (Prim.String "INTERSECT"), loc), fm)) + | L.EFfi ("Basis", "sql_except") => + (if #onlyUnion (Settings.currentDbms ()) then + ErrorMsg.errorAt loc "The DBMS you've selected doesn't support EXCEPT." + else + (); + ((L'.EPrim (Prim.String "EXCEPT"), loc), fm)) | L.ECApp ( (L.ECApp ( |