Mercurial > meta
diff 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 |
line wrap: on
line diff
--- a/sql.ur Thu Dec 29 14:15:02 2011 -0500 +++ b/sql.ur Sat Dec 31 15:49:54 2011 -0500 @@ -50,3 +50,13 @@ (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) (vs : $keyCols) = dml (delete t (@selector [#T] ! kfl kinj vs)) + +fun lookup [keyCols ::: {Type}] [otherCols ::: {Type}] [otherKeys ::: {{Unit}}] + [keyCols ~ otherCols] [[Pkey] ~ otherKeys] + (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols)) + (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) + (vs : $keyCols) + : transaction (option $otherCols) = + oneOrNoRows1 (SELECT t.{{otherCols}} + FROM t + WHERE {@selector [#T] ! kfl kinj (vs --- _)})