changeset 224:cb8a68964ebb

GROUP BY added to query type, with trivial parsing, for now
author Adam Chlipala <adamc@hcoop.net>
date Thu, 21 Aug 2008 12:54:09 -0400
parents bbe5899a9585
children 5ac2cf59b839
files lib/basis.lig src/lacweb.grm
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/basis.lig	Thu Aug 21 12:49:29 2008 -0400
+++ b/lib/basis.lig	Thu Aug 21 12:54:09 2008 -0400
@@ -29,14 +29,14 @@
         -> sql_subset tables tables
 
 val sql_query : tables ::: {{Type}}
-        (*-> grouped ::: {{Type}}*)
+        -> grouped ::: {{Type}}
         -> selected ::: {{Type}}
         -> {From : $(fold (fn nm => fn fields :: {Type} => fn acc =>
                 [nm] ~ acc => [nm = sql_table fields] ++ acc) [] tables),
             Where : sql_exp tables [] bool,
-            (*GroupBy : sql_subset tables grouped,
-            Having : sql_exp grouped tables bool,*)
-            SelectFields : sql_subset tables selected}
+            GroupBy : sql_subset tables grouped,
+            Having : sql_exp grouped tables bool,
+            SelectFields : sql_subset grouped selected}
         -> sql_query selected
 
 val sql_field : otherTabs ::: {{Type}} -> otherFields ::: {Type} -> fieldType ::: Type
--- a/src/lacweb.grm	Thu Aug 21 12:49:29 2008 -0400
+++ b/src/lacweb.grm	Thu Aug 21 12:54:09 2008 -0400
@@ -654,6 +654,12 @@
                                                                  (ERecord tables, loc)),
                                                                 ((CName "Where", loc),
                                                                  wopt),
+                                                                ((CName "GroupBy", loc),
+                                                                 (ECApp ((EVar (["Basis"], "sql_subset_all"), loc),
+                                                                         (CWild (KRecord (KRecord (KType, loc), loc),
+                                                                                 loc), loc)), loc)),
+                                                                ((CName "Having", loc),
+                                                                 hopt),
                                                                 ((CName "SelectFields", loc),
                                                                  (ECApp ((EVar (["Basis"], "sql_subset"), loc),
                                                                          sel), loc))], loc)