Mercurial > urweb
comparison src/monoize.sml @ 255:69d337f186eb
Monoized GROUP BY
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 15:04:10 -0400 |
parents | f8d9395575ec |
children | 40c33706d887 |
comparison
equal
deleted
inserted
replaced
254:f8d9395575ec | 255:69d337f186eb |
---|---|
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 sc " WHERE ", |
617 gf "Where" | 617 gf "Where", |
618 if List.all (fn (x, xts) => | |
619 case List.find (fn (x', _) => x' = x) grouped of | |
620 NONE => List.null xts | |
621 | SOME (_, xts') => | |
622 List.all (fn (x, _) => | |
623 List.exists (fn (x', _) => x' = x) | |
624 xts') xts) tables then | |
625 sc "" | |
626 else | |
627 strcat loc [ | |
628 sc " GROUP BY ", | |
629 strcatComma loc (map (fn (x, xts) => | |
630 strcatComma loc | |
631 (map (fn (x', _) => | |
632 sc (x ^ "." ^ x')) | |
633 xts)) grouped) | |
634 ] | |
618 ]), loc), | 635 ]), loc), |
619 fm) | 636 fm) |
620 | _ => poly () | 637 | _ => poly () |
621 end | 638 end |
622 | 639 |