adamc@638: datatype result = Neg | Zero | Pos
adamc@638:
adamc@638: table t : {A : int}
adamc@638:
adamc@638: fun main () : transaction page =
adamc@638: let
adamc@638: fun check () =
adamc@638: r <- oneRow (SELECT SUM(t.A) AS X FROM t);
adamc@638: return (if r.X < 0 then
adamc@638: Neg
adamc@638: else if r.X = 0 then
adamc@638: Zero
adamc@638: else
adamc@638: Pos)
adamc@638:
adamc@638: fun show r =
adamc@638: case r of
adamc@638: Neg => -
adamc@638: | Zero => 0
adamc@638: | Pos => +
adamc@638: in
adamc@638: s <- source Zero;
adamc@638: return
adamc@638:
adamc@638:
adamc@638: Current:
adamc@638:
adamc@638: end