diff src/monoize.sml @ 886:5805fa825fe8

Most of demo working with SQLite
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 17:03:37 -0400
parents dae141d911d9
children 034eeb099564
line wrap: on
line diff
--- a/src/monoize.sml	Fri Jul 17 16:29:36 2009 -0400
+++ b/src/monoize.sml	Fri Jul 17 17:03:37 2009 -0400
@@ -1606,19 +1606,35 @@
                      ((L'.EAbs ("fs", rt, (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
                                 (L'.EAbs ("tab", s, (L'.TFun (s, s), loc),
                                           (L'.EAbs ("e", s, s,
-                                                    strcat [sc "UPDATE ",
-                                                            (L'.ERel 1, loc),
-                                                            sc " AS T SET ",
-                                                            strcatComma (map (fn (x, _) =>
-                                                                                 strcat [sc ("uw_" ^ x
-                                                                                             ^ " = "),
-                                                                                         (L'.EField
-                                                                                              ((L'.ERel 2,
-                                                                                                loc),
-                                                                                               x), loc)])
-                                                                             changed),
-                                                            sc " WHERE ",
-                                                            (L'.ERel 0, loc)]), loc)), loc)), loc),
+                                                    if #supportsUpdateAs (Settings.currentDbms ()) then
+                                                        strcat [sc "UPDATE ",
+                                                                (L'.ERel 1, loc),
+                                                                sc " AS T SET ",
+                                                                strcatComma (map (fn (x, _) =>
+                                                                                     strcat [sc ("uw_" ^ x
+                                                                                                 ^ " = "),
+                                                                                             (L'.EField
+                                                                                                  ((L'.ERel 2,
+                                                                                                    loc),
+                                                                                                   x), loc)])
+                                                                                 changed),
+                                                                sc " WHERE ",
+                                                                (L'.ERel 0, loc)]
+                                                    else
+                                                        strcat [sc "UPDATE ",
+                                                                (L'.ERel 1, loc),
+                                                                sc " SET ",
+                                                                strcatComma (map (fn (x, _) =>
+                                                                                     strcat [sc ("uw_" ^ x
+                                                                                                 ^ " = "),
+                                                                                             (L'.EField
+                                                                                                  ((L'.ERel 2,
+                                                                                                    loc),
+                                                                                                   x), loc)])
+                                                                                 changed),
+                                                                sc " WHERE ",
+                                                                (L'.EFfiApp ("Basis", "unAs", [(L'.ERel 0, loc)]), loc)]),
+                                           loc)), loc)), loc),
                       fm)
                  end
                | _ => poly ())