From e23f4d764bc93640cb08a7d6ebd7e261fac2cb05 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 20 Oct 2009 11:05:58 -0400 Subject: Registering for Conference1 --- lib/ur/top.ur | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/ur/top.ur') diff --git a/lib/ur/top.ur b/lib/ur/top.ur index a2395d4f..6ffc888f 100644 --- a/lib/ur/top.ur +++ b/lib/ur/top.ur @@ -236,11 +236,16 @@ fun queryX' [tables ::: {{Type}}] [exps ::: {Type}] [ctx ::: {Unit}] 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 @@ fun oneRow [tables ::: {{Type}}] [exps ::: {Type}] None => error Query returned no rows | 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 Query returned no rows + | 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)) -- cgit v1.2.3