diff options
author | Adam Chlipala <adamc@hcoop.net> | 2010-03-16 15:54:35 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2010-03-16 15:54:35 -0400 |
commit | a33b1fdbf6ff02d806ac5c563f9274abc57b6a43 (patch) | |
tree | 9d33fe703a729a1a6e1317fea053f4a3a646cf52 /src | |
parent | 2bdffddbb847cbd620b8be911a1c1cb229187fc2 (diff) |
COUNT(col)
Diffstat (limited to 'src')
-rw-r--r-- | src/monoize.sml | 10 | ||||
-rw-r--r-- | src/urweb.grm | 9 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 5f616c05..8c050719 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -236,7 +236,7 @@ fun monoType env = (L'.TFfi ("Basis", "string"), loc) | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_binary"), _), _), _), _), _), _) => (L'.TFfi ("Basis", "string"), loc) - | L.CApp ((L.CFfi ("Basis", "sql_aggregate"), _), _) => + | L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_aggregate"), _), _), _), _) => (L'.TFfi ("Basis", "string"), loc) | L.CApp ((L.CFfi ("Basis", "sql_summable"), _), _) => (L'.TRecord [], loc) @@ -2371,7 +2371,9 @@ fun monoExp (env, st, fm) (all as (e, loc)) = (L.ECApp ( (L.ECApp ( (L.ECApp ( - (L.EFfi ("Basis", "sql_aggregate"), _), + (L.ECApp ( + (L.EFfi ("Basis", "sql_aggregate"), _), + _), _), _), _), _), _), _), _), @@ -2401,6 +2403,10 @@ fun monoExp (env, st, fm) (all as (e, loc)) = fm) end + | L.ECApp ((L.EFfi ("Basis", "sql_count_col"), _), _) => + ((L'.EPrim (Prim.String "COUNT"), loc), + fm) + | L.EFfi ("Basis", "sql_summable_int") => ((L'.ERecord [], loc), fm) | L.EFfi ("Basis", "sql_summable_float") => ((L'.ERecord [], loc), fm) | L.ECApp ((L.EFfi ("Basis", "sql_avg"), _), _) => diff --git a/src/urweb.grm b/src/urweb.grm index 647c311e..a6af8aa3 100644 --- a/src/urweb.grm +++ b/src/urweb.grm @@ -1738,6 +1738,15 @@ sqlexp : TRUE (sql_inject (EVar (["Basis"], "True", In in (EVar (["Basis"], "sql_count", Infer), loc) end) + | COUNT LPAREN sqlexp RPAREN (let + val loc = s (COUNTleft, RPARENright) + + val e = (EVar (["Basis"], "sql_count_col", Infer), loc) + val e = (EApp ((EVar (["Basis"], "sql_aggregate", Infer), loc), + e), loc) + in + (EApp (e, sqlexp), loc) + end) | sqlagg LPAREN sqlexp RPAREN (let val loc = s (sqlaggleft, RPARENright) |