diff sql.urs @ 26:c1da0e3749b3

Sql.listify
author Adam Chlipala <adam@chlipala.net>
date Sun, 13 May 2012 14:13:18 -0400
parents 875221eee987
children
line wrap: on
line diff
--- a/sql.urs	Sun May 06 15:16:27 2012 -0400
+++ b/sql.urs	Sun May 13 14:13:18 2012 -0400
@@ -39,3 +39,9 @@
              -> sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)
              -> $keyCols -> transaction (option $otherCols)
 (* Get the further columns associated with a table key. *)
+
+val listify : lead :: Name -> cols ::: {Type} -> rest ::: {{Type}} -> [[lead] ~ rest]
+              => folder cols -> $(map eq cols)
+              -> sql_query [] [] ([lead = cols] ++ rest) []
+              -> transaction (list ($cols * list $(map (fn ts => $ts) rest)))
+(* Shrink a set of table rows by summarizing into lists, keyed off of a lead table *)