comparison sql.ur @ 19:875221eee987

Sql.lookup
author Adam Chlipala <adam@chlipala.net>
date Sat, 31 Dec 2011 15:49:54 -0500
parents 6cd839818393
children c1da0e3749b3
comparison
equal deleted inserted replaced
18:6cd839818393 19:875221eee987
48 [keyCols ~ otherCols] [[Pkey] ~ otherKeys] 48 [keyCols ~ otherCols] [[Pkey] ~ otherKeys]
49 (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols)) 49 (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols))
50 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) 50 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys))
51 (vs : $keyCols) = 51 (vs : $keyCols) =
52 dml (delete t (@selector [#T] ! kfl kinj vs)) 52 dml (delete t (@selector [#T] ! kfl kinj vs))
53
54 fun lookup [keyCols ::: {Type}] [otherCols ::: {Type}] [otherKeys ::: {{Unit}}]
55 [keyCols ~ otherCols] [[Pkey] ~ otherKeys]
56 (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols))
57 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys))
58 (vs : $keyCols)
59 : transaction (option $otherCols) =
60 oneOrNoRows1 (SELECT t.{{otherCols}}
61 FROM t
62 WHERE {@selector [#T] ! kfl kinj (vs --- _)})