Mercurial > urweb
view tests/pquery.ur @ 295:1afa94582275
Reading ints and floats from SQL
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 07 Sep 2008 12:56:46 -0400 |
parents | fdd7a698be01 |
children | 5dc11235129d |
line wrap: on
line source
table t1 : {A : int, B : string, C : float} fun lookup (inp : {B : string}) = s <- query (SELECT * FROM t1 WHERE t1.B = {inp.B}) (fn fs _ => return fs.T1) {A = 0, B = "Couldn't find it!", C = 0.0}; return <html><body> A: {cdata (show _ s.A)}<br/> B: {cdata (show _ s.B)}<br/> C: {cdata (show _ s.C)}<br/> </body></html> fun main () : transaction page = return <html><body> <lform> B: <textbox{#B}/> <submit action={lookup}/> </lform> </body></html>