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
adamc@297: {case s of
adamc@297: None => cdata "Row not found."
adamc@297: | Some s =>
adamc@297:
adamc@297: A: {cdata (show _ s.A)}
adamc@297: B: {cdata (show _ s.B)}
adamc@297: C: {cdata (show _ s.C)}
adamc@297: D: {cdata (show _ s.D)}
adamc@297: }
adamc@280:
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
adamc@280:
adamc@297: A:
adamc@297:
adamc@297:
adamc@297:
adamc@297:
adamc@280: B:
adamc@297:
adamc@297:
adamc@297:
adamc@297:
adamc@297: C:
adamc@297:
adamc@297:
adamc@297:
adamc@297:
adamc@297: D:
adamc@297:
adamc@280:
adamc@280: