Mercurial > urweb
annotate tests/pquery.ur @ 282:0236d9412ad2
Ran a prepared statement with one string parameter
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 07 Sep 2008 09:28:13 -0400 |
parents | fdd7a698be01 |
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> |