Mercurial > urweb
diff lib/ur/top.ur @ 1003:61c30f0742d7
Registering for Conference1
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 20 Oct 2009 11:05:58 -0400 |
parents | 10114d7b7477 |
children | a87495bcaeec |
line wrap: on
line diff
--- a/lib/ur/top.ur Tue Oct 20 10:29:17 2009 -0400 +++ b/lib/ur/top.ur Tue Oct 20 11:05:58 2009 -0400 @@ -236,11 +236,16 @@ fun oneOrNoRows [tables ::: {{Type}}] [exps ::: {Type}] [tables ~ exps] - (q : sql_query tables exps) = + (q : sql_query tables exps) = query q (fn fs _ => return (Some fs)) None +fun oneOrNoRows1 [nm ::: Name] [fs ::: {Type}] (q : sql_query [nm = fs] []) = + query q + (fn fs _ => return (Some fs.nm)) + None + fun oneRow [tables ::: {{Type}}] [exps ::: {Type}] [tables ~ exps] (q : sql_query tables exps) = o <- oneOrNoRows q; @@ -248,6 +253,12 @@ None => error <xml>Query returned no rows</xml> | Some r => r) +fun oneRowE1 [tab ::: Name] [nm ::: Name] [t ::: Type] [[tab] ~ [nm]] (q : sql_query [tab = []] [nm = t]) = + o <- oneOrNoRows q; + return (case o of + None => error <xml>Query returned no rows</xml> + | Some r => r.nm) + fun eqNullable [tables ::: {{Type}}] [agg ::: {{Type}}] [exps ::: {Type}] [t ::: Type] (_ : sql_injectable (option t)) (e1 : sql_exp tables agg exps (option t))