summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--caching-tests/bench.ur24
-rw-r--r--caching-tests/bench.urp5
-rw-r--r--caching-tests/bench.urs1
-rw-r--r--caching-tests/test.urp2
4 files changed, 31 insertions, 1 deletions
diff --git a/caching-tests/bench.ur b/caching-tests/bench.ur
new file mode 100644
index 00000000..0c7bb674
--- /dev/null
+++ b/caching-tests/bench.ur
@@ -0,0 +1,24 @@
+table tab : {Id : int, Val : int} PRIMARY KEY Id
+
+fun check id =
+ res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]});
+ return <xml><body>
+ {case res of
+ None => <xml>?</xml>
+ | Some row => <xml>{[row.Tab.Val]}</xml>}
+ </body></xml>
+
+fun flush id =
+ dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]});
+ return <xml><body>
+ Changed {[id]}!
+ </body></xml>
+
+fun main x y =
+ r <- rand;
+ let
+ val id = r % x
+ val doFlush = (r / x) % y = 0
+ in
+ if doFlush then flush id else check id
+ end
diff --git a/caching-tests/bench.urp b/caching-tests/bench.urp
new file mode 100644
index 00000000..e2c16376
--- /dev/null
+++ b/caching-tests/bench.urp
@@ -0,0 +1,5 @@
+database host=localhost
+sql bench.sql
+safeGet Bench/main
+
+bench
diff --git a/caching-tests/bench.urs b/caching-tests/bench.urs
new file mode 100644
index 00000000..0f780541
--- /dev/null
+++ b/caching-tests/bench.urs
@@ -0,0 +1 @@
+val main : int -> int -> transaction page
diff --git a/caching-tests/test.urp b/caching-tests/test.urp
index dd8cf774..07922e69 100644
--- a/caching-tests/test.urp
+++ b/caching-tests/test.urp
@@ -1,4 +1,4 @@
-database host=localhost dbname=ziv
+database host=localhost
sql test.sql
safeGet Test/flush
safeGet Test/flash