diff options
author | 2008-09-13 19:49:53 -0400 | |
---|---|---|
committer | 2008-09-13 19:49:53 -0400 | |
commit | 92865c5cf94bde77b7250450042e915a48e0025d (patch) | |
tree | 356d6e919b861559a016a13aeedc5a32fac63dd3 /tests | |
parent | a5a647f670f8e2fa7749e29aee39e2511afb2a21 (diff) |
queryX
Diffstat (limited to 'tests')
-rw-r--r-- | tests/crud.ur | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/tests/crud.ur b/tests/crud.ur index 95d2d4b9..7f0fc71c 100644 --- a/tests/crud.ur +++ b/tests/crud.ur @@ -14,10 +14,9 @@ end) = struct open constraints M val tab = M.tab -fun list () = - rows <- query (SELECT * FROM tab AS T) - (fn (fs : {T : $([Id = int] ++ M.cols)}) acc => return <body> - {acc} +fun main () : transaction page = + rows <- queryX (SELECT * FROM tab AS T) + (fn (fs : {T : $([Id = int] ++ M.cols)}) => <body> <tr> <td>{txt _ fs.T.Id}</td> {foldTRX2 [idT] [colMeta'] [tr] @@ -28,13 +27,13 @@ fun list () = </tr>) [M.cols] (fs.T -- #Id) M.cols} </tr> - </body>) <body></body>; + </body>); return <html><head> - <title>List</title> + <title>{cdata M.title}</title> </head><body> - <h1>List</h1> + <h1>{cdata M.title}</h1> <table border={1}> <tr> <th>ID</th> </tr> @@ -42,12 +41,4 @@ fun list () = </table> </body></html> -fun main () : transaction page = return <html><head> - <title>{cdata M.title}</title> - </head><body> - <h1>{cdata M.title}</h1> - - <li> <a link={list ()}>List all rows</a></li> -</body></html> - end |