Mercurial > urweb
comparison demo/chat.ur @ 732:5819fb63c93a
Effectness analysis
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 16 Apr 2009 15:29:39 -0400 |
parents | 1a317a707d71 |
children | ed06e25c70ef |
comparison
equal
deleted
inserted
replaced
731:e0dd85ea58e1 | 732:5819fb63c93a |
---|---|
4 | 4 |
5 sequence s | 5 sequence s |
6 table t : { Id : int, Title : string, Room : Room.topic } | 6 table t : { Id : int, Title : string, Room : Room.topic } |
7 PRIMARY KEY Id | 7 PRIMARY KEY Id |
8 | 8 |
9 fun chat id = | 9 fun chat id () = |
10 r <- oneRow (SELECT t.Title, t.Room FROM t WHERE t.Id = {[id]}); | 10 r <- oneRow (SELECT t.Title, t.Room FROM t WHERE t.Id = {[id]}); |
11 ch <- Room.subscribe r.T.Room; | 11 ch <- Room.subscribe r.T.Room; |
12 | 12 |
13 newLine <- source ""; | 13 newLine <- source ""; |
14 buf <- Buffer.create; | 14 buf <- Buffer.create; |
53 queryX' (SELECT * FROM t) | 53 queryX' (SELECT * FROM t) |
54 (fn r => | 54 (fn r => |
55 count <- Room.subscribers r.T.Room; | 55 count <- Room.subscribers r.T.Room; |
56 return <xml><tr> | 56 return <xml><tr> |
57 <td>{[r.T.Id]}</td> | 57 <td>{[r.T.Id]}</td> |
58 <td><a link={chat r.T.Id}>{[r.T.Title]}</a></td> | 58 <td>{[r.T.Title]}</td> |
59 <td>{[count]}</td> | 59 <td>{[count]}</td> |
60 <td><a link={delete r.T.Id}>[delete]</a></td> | 60 <td><form><submit action={chat r.T.Id} value="Enter"/></form></td> |
61 <td><form><submit action={delete r.T.Id} value="Delete"/></form></td> | |
61 </tr></xml>) | 62 </tr></xml>) |
62 | 63 |
63 and delete id = | 64 and delete id () = |
64 dml (DELETE FROM t WHERE Id = {[id]}); | 65 dml (DELETE FROM t WHERE Id = {[id]}); |
65 main () | 66 main () |
66 | 67 |
67 and main () = | 68 and main () = |
68 let | 69 let |