diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-03-29 14:13:50 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-03-29 14:13:50 -0400 |
commit | 92924ca980aa1ae361b242bbed9c6b5d4dacada3 (patch) | |
tree | 1b2655ca5cafb564b522b9d0ac9b9ec15b5d6aec /src/monoize.sml | |
parent | 5430dbfa3f1c7c0adaabc230e86ffd90e6f923da (diff) |
Expunging nullable fields
Diffstat (limited to 'src/monoize.sml')
-rw-r--r-- | src/monoize.sml | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 50678be4..361986d2 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -2500,33 +2500,44 @@ fun monoize env file = | _ => st) | _ => st) ([], []) xts + fun cond (x, v) = + (L'.EStrcat ((L'.EPrim (Prim.String ("uw_" ^ x + ^ (case v of + Client => "" + | Channel => " >> 32") + ^ " = ")), loc), + target), loc) + + val e = + foldl (fn ((x, v), e) => + (L'.ESeq ( + (L'.EDml (L'.EStrcat ( + (L'.EPrim (Prim.String ("UPDATE uw_" + ^ tab + ^ " SET uw_" + ^ x + ^ " = NULL WHERE ")), loc), + cond (x, v)), loc), loc), + e), loc)) + e nullable + val e = case notNullable of [] => e | eb :: ebs => - let - fun cond (x, v) = - (L'.EStrcat ((L'.EPrim (Prim.String ("uw_" ^ x - ^ (case v of - Client => "" - | Channel => " >> 32") - ^ " = ")), loc), - target), loc) - in - (L'.ESeq ( - (L'.EDml (foldl - (fn (eb, s) => - (L'.EStrcat (s, - (L'.EStrcat ((L'.EPrim (Prim.String " AND "), - loc), - cond eb), loc)), loc)) - (L'.EStrcat ((L'.EPrim (Prim.String ("DELETE FROM uw_" - ^ tab - ^ " WHERE ")), loc), - cond eb), loc) - ebs), loc), - e), loc) - end + (L'.ESeq ( + (L'.EDml (foldl + (fn (eb, s) => + (L'.EStrcat (s, + (L'.EStrcat ((L'.EPrim (Prim.String " AND "), + loc), + cond eb), loc)), loc)) + (L'.EStrcat ((L'.EPrim (Prim.String ("DELETE FROM uw_" + ^ tab + ^ " WHERE ")), loc), + cond eb), loc) + ebs), loc), + e), loc) in e end |