annotate tests/group_by.ur @ 1384:86d23010ea74
Ignore unknown names in query string name-value pairs; allow any side effects by Extern URLs, without signature checking
author |
Adam Chlipala <adam@chlipala.net> |
date |
Thu, 06 Jan 2011 12:49:14 -0500 |
parents |
d1b679dbbc25 |
children |
|
rev |
line source |
adamc@226
|
1 table t1 : {A : int, B : string, C : float}
|
adamc@226
|
2 table t2 : {A : float, D : int}
|
adamc@226
|
3
|
adamc@226
|
4 val q1 = (SELECT * FROM t1 GROUP BY t1.B)
|
adamc@226
|
5 val q2 = (SELECT * FROM t1, t2 GROUP BY t1.B, t2.D, t1.A)
|
adamc@227
|
6
|
adamc@227
|
7 val q3 = (SELECT * FROM t1 WHERE t1.A = 0 GROUP BY t1.B)
|
adamc@259
|
8 val q4 = (SELECT * FROM t1 WHERE t1.A = 0 GROUP BY t1.B HAVING t1.B <> 'Bad')
|
adamc@227
|
9
|
adamc@227
|
10 val q5 = (SELECT t1.A, t2.D FROM t1, t2 GROUP BY t2.D, t1.A)
|
adamc@228
|
11 val q6 = (SELECT t1.A, t2.D FROM t1, t2 WHERE t1.C = 0.0 GROUP BY t2.D, t1.A HAVING t1.A = t1.A AND t2.D = 17)
|
adamc@255
|
12
|
adamc@255
|
13
|
adamc@255
|
14 datatype list a = Nil | Cons of a * list a
|
adamc@255
|
15
|
adamc@255
|
16 val r1 : transaction (list {B : string}) =
|
adamc@259
|
17 query q4
|
adamc@255
|
18 (fn fs acc => return (Cons (fs.T1, acc)))
|
adamc@255
|
19 Nil
|
adamc@255
|
20
|
adamc@255
|
21 val r2 : transaction string =
|
adamc@255
|
22 ls <- r1;
|
adamc@255
|
23 return (case ls of
|
adamc@255
|
24 Nil => "Problem"
|
adamc@255
|
25 | Cons ({B = b, ...}, _) => b)
|
adamc@255
|
26
|
adamc@255
|
27 val main : unit -> transaction page = fn () =>
|
adamc@255
|
28 s <- r2;
|
adamc@255
|
29 return <html><body>
|
adamc@255
|
30 {cdata s}
|
adamc@255
|
31 </body></html>
|