From bfcd84434ee997b474935aa13ae7bc1f3801d795 Mon Sep 17 00:00:00 2001 From: Ziv Scully Date: Thu, 19 Nov 2015 01:59:00 -0500 Subject: Support nested queries but disable UrFlow for now. --- caching-tests/test.ur | 71 ++++++++++++++++++++++++++++---------------------- caching-tests/test.urp | 4 +-- caching-tests/test.urs | 7 ++--- 3 files changed, 46 insertions(+), 36 deletions(-) (limited to 'caching-tests') diff --git a/caching-tests/test.ur b/caching-tests/test.ur index cbfde556..ea64bb2d 100644 --- a/caching-tests/test.ur +++ b/caching-tests/test.ur @@ -1,9 +1,7 @@ table tab : {Id : int, Val : int, Foo : int} PRIMARY KEY Id fun cache id = - res <- oneOrNoRows (SELECT tab.Val - FROM tab - WHERE tab.Id = {[id]}); + res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); return cache {case res of @@ -11,21 +9,32 @@ fun cache id = | Some row => {[row.Tab.Val]}} -fun sillyRecursive {Id = id : int, FooBar = fooBar} = - if fooBar <= 0 - then 0 - else 1 + sillyRecursive {Id = id, FooBar = fooBar - 1} +(* fun cacheAlt id = *) +(* res <- oneOrNoRows (SELECT Q.Id *) +(* FROM (SELECT Tab.Id AS Id FROM tab WHERE Tab.Id = {[id]}) *) +(* AS Q); *) +(* return *) +(* cacheAlt *) +(* {case res of *) +(* None => ? *) +(* | Some row => {[row.Q.Id]}} *) +(* *) -fun cacheR (r : {Id : int, FooBar : int}) = - res <- oneOrNoRows (SELECT tab.Val - FROM tab - WHERE tab.Id = {[r.Id]}); - return - cacheR {[r.FooBar]} - {case res of - None => ? - | Some row => {[row.Tab.Val]}} - +(* fun sillyRecursive {Id = id : int, FooBar = fooBar} = *) +(* if fooBar <= 0 *) +(* then 0 *) +(* else 1 + sillyRecursive {Id = id, FooBar = fooBar - 1} *) + +(* fun cacheR (r : {Id : int, FooBar : int}) = *) +(* res <- oneOrNoRows (SELECT tab.Val *) +(* FROM tab *) +(* WHERE tab.Id = {[r.Id]}); *) +(* return *) +(* cacheR {[r.FooBar]} *) +(* {case res of *) +(* None => ? *) +(* | Some row => {[row.Tab.Val]}} *) +(* *) (* fun cache2 id v = *) (* res <- oneOrNoRows (SELECT tab.Val *) @@ -60,21 +69,21 @@ fun flush id = Changed {[id]}! -fun flash id = - dml (UPDATE tab - SET Foo = Val - WHERE Id = {[id]} OR Id = {[id - 1]} OR Id = {[id + 1]}); - return - Maybe changed {[id]}? - +(* fun flash id = *) +(* dml (UPDATE tab *) +(* SET Foo = Val *) +(* WHERE Id = {[id]} OR Id = {[id - 1]} OR Id = {[id + 1]}); *) +(* return *) +(* Maybe changed {[id]}? *) +(* *) -fun floosh id = - dml (UPDATE tab - SET Id = {[id + 1]} - WHERE Id = {[id]}); - return - Shifted {[id]}! - +(* fun floosh id = *) +(* dml (UPDATE tab *) +(* SET Id = {[id + 1]} *) +(* WHERE Id = {[id]} OR Id = {[id - 1]} OR Id = {[id + 1]}); *) +(* return *) +(* Shifted {[id]}! *) +(* *) (* val flush17 = *) (* dml (UPDATE tab *) diff --git a/caching-tests/test.urp b/caching-tests/test.urp index 07922e69..2cb9e711 100644 --- a/caching-tests/test.urp +++ b/caching-tests/test.urp @@ -1,8 +1,8 @@ database host=localhost sql test.sql safeGet Test/flush -safeGet Test/flash -safeGet Test/floosh +# safeGet Test/flash +# safeGet Test/floosh # safeGet Test/flush17 minHeap 4096 diff --git a/caching-tests/test.urs b/caching-tests/test.urs index 1fa5a9c2..d6e8dd2e 100644 --- a/caching-tests/test.urs +++ b/caching-tests/test.urs @@ -1,7 +1,8 @@ val cache : int -> transaction page -val cacheR : {Id : int, FooBar : int} -> transaction page +(* val cacheAlt : int -> transaction page *) +(* val cacheR : {Id : int, FooBar : int} -> transaction page *) (* val cache2 : int -> int -> transaction page *) val flush : int -> transaction page -val flash : int -> transaction page -val floosh : int -> transaction page +(* val flash : int -> transaction page *) +(* val floosh : int -> transaction page *) (* val flush17 : transaction page *) -- cgit v1.2.3