From 1589307fcb887ec55b5baea7445747b479a665d2 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 13 Dec 2009 14:34:18 -0500 Subject: Fixing a bug in DInitializer elaboration --- lib/ur/top.ur | 3 +++ lib/ur/top.urs | 3 +++ 2 files changed, 6 insertions(+) (limited to 'lib/ur') diff --git a/lib/ur/top.ur b/lib/ur/top.ur index 8b737179..78a799b1 100644 --- a/lib/ur/top.ur +++ b/lib/ur/top.ur @@ -271,6 +271,9 @@ fun oneRowE1 [tabs ::: {Unit}] [nm ::: Name] [t ::: Type] [tabs ~ [nm]] (q : sql None => error Query returned no rows | Some r => r.nm) +fun nonempty [fs] [us] (t : sql_table fs us) = + oneRowE1 (SELECT COUNT( * ) > 0 AS B FROM t) + fun eqNullable [tables ::: {{Type}}] [agg ::: {{Type}}] [exps ::: {Type}] [t ::: Type] (_ : sql_injectable (option t)) (e1 : sql_exp tables agg exps (option t)) diff --git a/lib/ur/top.urs b/lib/ur/top.urs index 59ffec92..57bc2b1e 100644 --- a/lib/ur/top.urs +++ b/lib/ur/top.urs @@ -173,6 +173,9 @@ val oneRowE1 : tabs ::: {Unit} -> nm ::: Name -> t ::: Type sql_query (mapU [] tabs) [nm = t] -> transaction t +val nonempty : fs ::: {Type} -> us ::: {{Unit}} -> sql_table fs us + -> transaction bool + val eqNullable : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type} -> t ::: Type -> sql_injectable (option t) -> sql_exp tables agg exps (option t) -- cgit v1.2.3