diff src/prepare.sml @ 322:aa89b73d83e4

Improve detection of opportunities for prepared statements with bool parameters
author Adam Chlipala <adamc@hcoop.net>
date Thu, 11 Sep 2008 12:22:06 -0400
parents 04ebfe929a98
children e976b187d73a
line wrap: on
line diff
--- a/src/prepare.sml	Thu Sep 11 12:12:22 2008 -0400
+++ b/src/prepare.sml	Thu Sep 11 12:22:06 2008 -0400
@@ -45,6 +45,12 @@
         SOME ("$" ^ Int.toString (n + 1) ^ "::text" :: ss, n + 1)
       | EFfiApp ("Basis", "sqlifyBool", [e]) =>
         SOME ("$" ^ Int.toString (n + 1) ^ "::bool" :: ss, n + 1)
+      | ECase (e,
+               [((PCon (_, PConFfi {mod = "Basis", con = "True", ...}, _), _),
+                 (EPrim (Prim.String "TRUE"), _)),
+                ((PCon (_, PConFfi {mod = "Basis", con = "False", ...}, _), _),
+                 (EPrim (Prim.String "FALSE"), _))],
+               _) => SOME ("$" ^ Int.toString (n + 1) ^ "::bool" :: ss, n + 1)
 
       | _ => NONE