diff tests/rpcN.ur @ 614:5891f47d7cff

Parameterized RPC query
author Adam Chlipala <adamc@hcoop.net>
date Sun, 15 Feb 2009 13:03:09 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/rpcN.ur	Sun Feb 15 13:03:09 2009 -0500
@@ -0,0 +1,16 @@
+table t : { A : int }
+
+fun main () : transaction page =
+    let
+        fun count a = r <- oneRow (SELECT COUNT( * ) AS N FROM t WHERE t.A = {[a]});
+                      return r.N
+    in
+        s <- source 0;
+        return <xml><body>
+          <button value="Get It On!"
+                  onclick={n <- count 3;
+                           set s n}/><br/>
+          <br/>
+          Current: <dyn signal={n <- signal s; return <xml>{[n]}</xml>}/>
+        </body></xml>
+    end