diff options
author | 2009-10-31 15:51:50 -0400 | |
---|---|---|
committer | 2009-10-31 15:51:50 -0400 | |
commit | 1be7e54fa70a40b16164f69e7153ada0e4935994 (patch) | |
tree | 83db5727103dd54a22787218cd8325e80059cc96 /demo/more/bid.ur | |
parent | 2385b6b946eb1215d75a3dddccb05aaf8f605ba3 (diff) |
Start of bidding implementation compiles
Diffstat (limited to 'demo/more/bid.ur')
-rw-r--r-- | demo/more/bid.ur | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/demo/more/bid.ur b/demo/more/bid.ur new file mode 100644 index 00000000..5bcaea3a --- /dev/null +++ b/demo/more/bid.ur @@ -0,0 +1,34 @@ +functor Make(M : Conference.INPUT) = struct + open M + + table bid : {User : userId, Paper : paperId, Interest : char} + PRIMARY KEY (User, Paper) + + table assignment : {User : userId, Paper : paperId} + PRIMARY KEY (User, Paper) + + fun isOnPc id = + ro <- oneOrNoRows1 (SELECT user.OnPc + FROM user + WHERE user.Id = {[id]}); + return (case ro of + None => False + | Some r => r.OnPc) + + val linksForPc = + let + fun bid () = + me <- getLogin; + return <xml>Bidding time!</xml> + in + <xml> + <li> <a link={bid ()}>Bid on papers</a></li> + </xml> + end + + con yourPaperTables = [Assignment = _] + constraint [Paper] ~ yourPaperTables + fun joinYourPaper [tabs] [paper] [[Paper] ~ tabs] [[Paper] ~ _] [tabs ~ yourPaperTables] [[Id] ~ paper] + (fi : sql_from_items ([Paper = [Id = paperId] ++ paper] ++ tabs)) = + sql_inner_join fi (sql_from_table [#Assignment] assignment) (WHERE Paper.Id = Assignment.Paper) +end |