diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-09-11 12:22:06 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-09-11 12:22:06 -0400 |
commit | 549b3c11b75bb08eb6b686d2d1a04bc0ec7647a9 (patch) | |
tree | 50b65dd78d1529f8f39632d2bae04c672e89faa9 | |
parent | 0ee5e278e328dd8bb567932cdb99944d0fbe206f (diff) |
Improve detection of opportunities for prepared statements with bool parameters
-rw-r--r-- | src/cjr_print.sml | 1 | ||||
-rw-r--r-- | src/prepare.sml | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index a6eb0ffe..73a4f0fc 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -425,6 +425,7 @@ fun getPargs (e, _) = | EFfiApp ("Basis", "sqlifyFloat", [e]) => [(e, Float)] | EFfiApp ("Basis", "sqlifyString", [e]) => [(e, String)] | EFfiApp ("Basis", "sqlifyBool", [e]) => [(e, Bool)] + | ECase (e, _, _) => [(e, Bool)] | _ => raise Fail "CjrPrint: getPargs" diff --git a/src/prepare.sml b/src/prepare.sml index a6b6a4f3..20a09c9b 100644 --- a/src/prepare.sml +++ b/src/prepare.sml @@ -45,6 +45,12 @@ fun prepString (e, ss, n) = 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 |