# HG changeset patch # User Adam Chlipala # Date 1221150126 14400 # Node ID aa89b73d83e4fbb299061b16870b5342276344dd # Parent cd4cabaf3e52bd9d40c63505dc3abe07714c395f Improve detection of opportunities for prepared statements with bool parameters diff -r cd4cabaf3e52 -r aa89b73d83e4 src/cjr_print.sml --- a/src/cjr_print.sml Thu Sep 11 12:12:22 2008 -0400 +++ b/src/cjr_print.sml Thu Sep 11 12:22:06 2008 -0400 @@ -425,6 +425,7 @@ | 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 -r cd4cabaf3e52 -r aa89b73d83e4 src/prepare.sml --- 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