summaryrefslogtreecommitdiff
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-10-20 11:05:58 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-10-20 11:05:58 -0400
commite23f4d764bc93640cb08a7d6ebd7e261fac2cb05 (patch)
treed11bc3451bff30a58f66c2d1dbb41852526a308f /lib/ur/top.ur
parent66fa98fe9619afa56b10f1357edb617dc813051c (diff)
Registering for Conference1
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r--lib/ur/top.ur13
1 files changed, 12 insertions, 1 deletions
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 <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))