comparison src/monoize.sml @ 258:40c33706d887

Avoid unnecessary WHERE clause
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 15:32:31 -0400
parents 69d337f186eb
children d1b679dbbc25
comparison
equal deleted inserted replaced
257:32f9212583b2 258:40c33706d887
611 sc (x ^ "." ^ x')) 611 sc (x ^ "." ^ x'))
612 xts)) stables), 612 xts)) stables),
613 sc " FROM ", 613 sc " FROM ",
614 strcatComma loc (map (fn (x, _) => strcat loc [(L'.EField (gf "From", x), loc), 614 strcatComma loc (map (fn (x, _) => strcat loc [(L'.EField (gf "From", x), loc),
615 sc (" AS " ^ x)]) tables), 615 sc (" AS " ^ x)]) tables),
616 sc " WHERE ", 616 (L'.ECase (gf "Where",
617 gf "Where", 617 [((L'.PPrim (Prim.String "TRUE"), loc),
618 sc ""),
619 ((L'.PWild, loc),
620 strcat loc [sc " WHERE ", gf "Where"])],
621 {disc = s,
622 result = s}), loc),
623
618 if List.all (fn (x, xts) => 624 if List.all (fn (x, xts) =>
619 case List.find (fn (x', _) => x' = x) grouped of 625 case List.find (fn (x', _) => x' = x) grouped of
620 NONE => List.null xts 626 NONE => List.null xts
621 | SOME (_, xts') => 627 | SOME (_, xts') =>
622 List.all (fn (x, _) => 628 List.all (fn (x, _) =>