comparison sql.urs @ 26:c1da0e3749b3

Sql.listify
author Adam Chlipala <adam@chlipala.net>
date Sun, 13 May 2012 14:13:18 -0400
parents 875221eee987
children
comparison
equal deleted inserted replaced
25:9f56676e7c4e 26:c1da0e3749b3
37 -> [keyCols ~ otherCols] => [[Pkey] ~ otherKeys] 37 -> [keyCols ~ otherCols] => [[Pkey] ~ otherKeys]
38 => folder keyCols -> $(map sql_injectable keyCols) 38 => folder keyCols -> $(map sql_injectable keyCols)
39 -> sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys) 39 -> sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)
40 -> $keyCols -> transaction (option $otherCols) 40 -> $keyCols -> transaction (option $otherCols)
41 (* Get the further columns associated with a table key. *) 41 (* Get the further columns associated with a table key. *)
42
43 val listify : lead :: Name -> cols ::: {Type} -> rest ::: {{Type}} -> [[lead] ~ rest]
44 => folder cols -> $(map eq cols)
45 -> sql_query [] [] ([lead = cols] ++ rest) []
46 -> transaction (list ($cols * list $(map (fn ts => $ts) rest)))
47 (* Shrink a set of table rows by summarizing into lists, keyed off of a lead table *)