summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2016-03-12 20:44:00 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2016-03-12 20:44:00 -0500
commiteb715ea49f6d74f5ac7b7f2967f4a86c4db0a75f (patch)
tree298f93f0f26637aad030342331c31bf8e4fd5d95 /src/monoize.sml
parentce046247973013fe5dbcf3c18dd3aba889155c6c (diff)
Use IS NOT DISTINCT FROM; improve Sql parser
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index 6715290f..6979474e 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2326,24 +2326,31 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
val body = case #1 arg1 of
L.CApp ((L.CFfi ("Basis", "option"), _), _) =>
- (L'.ECase ((L'.ERel 2, loc),
- [((L'.PPrim (Prim.String (Prim.Normal, "=")), loc),
- strcat [str "((",
- (L'.ERel 1, loc),
- str " ",
- (L'.ERel 2, loc),
- str " ",
- (L'.ERel 0, loc),
- str ") OR ((",
- (L'.ERel 1, loc),
- str ") IS NULL AND (",
- (L'.ERel 0, loc),
- str ") IS NULL))"]),
- ((L'.PVar ("_", s), loc),
- default 1)],
- {disc = s,
- result = s}), loc)
- | _ => default 0
+ (L'.ECase ((L'.ERel 2, loc),
+ [((L'.PPrim (Prim.String (Prim.Normal, "=")), loc),
+ if #supportsIsDistinctFrom (Settings.currentDbms ()) then
+ strcat [str "((",
+ (L'.ERel 1, loc),
+ str " IS NOT DISTINCT FROM ",
+ (L'.ERel 0, loc),
+ str "))"]
+ else
+ strcat [str "((",
+ (L'.ERel 1, loc),
+ str " ",
+ (L'.ERel 2, loc),
+ str " ",
+ (L'.ERel 0, loc),
+ str ") OR ((",
+ (L'.ERel 1, loc),
+ str ") IS NULL AND (",
+ (L'.ERel 0, loc),
+ str ") IS NULL))"]),
+ ((L'.PVar ("_", s), loc),
+ default 1)],
+ {disc = s,
+ result = s}), loc)
+ | _ => default 0
in
((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
(L'.EAbs ("e1", s, (L'.TFun (s, s), loc),