Mercurial > urweb
comparison demo/more/bid.ur @ 1022:4de35df3d545
Start of bidding implementation compiles
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 31 Oct 2009 15:51:50 -0400 |
parents | |
children | e46227efcbba |
comparison
equal
deleted
inserted
replaced
1021:7a4a55e05081 | 1022:4de35df3d545 |
---|---|
1 functor Make(M : Conference.INPUT) = struct | |
2 open M | |
3 | |
4 table bid : {User : userId, Paper : paperId, Interest : char} | |
5 PRIMARY KEY (User, Paper) | |
6 | |
7 table assignment : {User : userId, Paper : paperId} | |
8 PRIMARY KEY (User, Paper) | |
9 | |
10 fun isOnPc id = | |
11 ro <- oneOrNoRows1 (SELECT user.OnPc | |
12 FROM user | |
13 WHERE user.Id = {[id]}); | |
14 return (case ro of | |
15 None => False | |
16 | Some r => r.OnPc) | |
17 | |
18 val linksForPc = | |
19 let | |
20 fun bid () = | |
21 me <- getLogin; | |
22 return <xml>Bidding time!</xml> | |
23 in | |
24 <xml> | |
25 <li> <a link={bid ()}>Bid on papers</a></li> | |
26 </xml> | |
27 end | |
28 | |
29 con yourPaperTables = [Assignment = _] | |
30 constraint [Paper] ~ yourPaperTables | |
31 fun joinYourPaper [tabs] [paper] [[Paper] ~ tabs] [[Paper] ~ _] [tabs ~ yourPaperTables] [[Id] ~ paper] | |
32 (fi : sql_from_items ([Paper = [Id = paperId] ++ paper] ++ tabs)) = | |
33 sql_inner_join fi (sql_from_table [#Assignment] assignment) (WHERE Paper.Id = Assignment.Paper) | |
34 end |