adamc@296: table t1 : {A : int, B : string, C : float, D : bool}
adamc@280: 
adamc@297: fun display (q : sql_query [T1 = [A = int, B = string, C = float, D = bool]] []) =
adamc@297:         s <- query q
adamc@297:                 (fn fs _ => return (Some fs.T1))
adamc@297:                 None;
adamc@280:         return <html><body>
adamc@297:                 {case s of
adamc@297:                   None => cdata "Row not found."
adamc@297:                 | Some s =>
adamc@297:                         <body>
adamc@297:                                 A: {cdata (show _ s.A)}<br/>
adamc@297:                                 B: {cdata (show _ s.B)}<br/>
adamc@297:                                 C: {cdata (show _ s.C)}<br/>
adamc@297:                                 D: {cdata (show _ s.D)}<br/>
adamc@297:                         </body>}
adamc@280:         </body></html>
adamc@280: 
adamc@297: fun lookupA (inp : {A : string}) =
adamc@298:         display (SELECT * FROM t1 WHERE t1.A = {readError _ inp.A})
adamc@297: 
adamc@297: fun lookupB (inp : {B : string}) =
adamc@297:         display (SELECT * FROM t1 WHERE t1.B = {inp.B})
adamc@297: 
adamc@297: fun lookupC (inp : {C : string}) =
adamc@298:         display (SELECT * FROM t1 WHERE t1.C = {readError _ inp.C})
adamc@297: 
adamc@297: fun lookupD (inp : {D : string}) =
adamc@298:         display (SELECT * FROM t1 WHERE t1.D = {readError _ inp.D})
adamc@297: 
adamc@280: fun main () : transaction page = return <html><body>
adamc@280:         <lform>
adamc@297:                 A: <textbox{#A}/>
adamc@297:                 <submit action={lookupA}/>
adamc@297:         </lform>
adamc@297: 
adamc@297:         <lform>
adamc@280:                 B: <textbox{#B}/>
adamc@297:                 <submit action={lookupB}/>
adamc@297:         </lform>
adamc@297: 
adamc@297:         <lform>
adamc@297:                 C: <textbox{#C}/>
adamc@297:                 <submit action={lookupC}/>
adamc@297:         </lform>
adamc@297: 
adamc@297:         <lform>
adamc@297:                 D: <textbox{#D}/>
adamc@297:                 <submit action={lookupD}/>
adamc@280:         </lform>
adamc@280: </body></html>