Mercurial > urweb
annotate tests/pquery.ur @ 280:fdd7a698be01
Compiling a parametrized query the inefficient way
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 02 Sep 2008 17:31:45 -0400 |
parents | |
children | 1afa94582275 |
rev | line source |
---|---|
adamc@280 | 1 table t1 : {A : int, B : string, C : float} |
adamc@280 | 2 |
adamc@280 | 3 fun lookup (inp : {B : string}) = |
adamc@280 | 4 s <- query (SELECT t1.B FROM t1 WHERE t1.B = {inp.B}) |
adamc@280 | 5 (fn fs _ => return fs.T1.B) |
adamc@280 | 6 "Couldn't find it!"; |
adamc@280 | 7 return <html><body> |
adamc@280 | 8 Result: {cdata s} |
adamc@280 | 9 </body></html> |
adamc@280 | 10 |
adamc@280 | 11 fun main () : transaction page = return <html><body> |
adamc@280 | 12 <lform> |
adamc@280 | 13 B: <textbox{#B}/> |
adamc@280 | 14 <submit action={lookup}/> |
adamc@280 | 15 </lform> |
adamc@280 | 16 </body></html> |