adamc@651: datatype list t = Nil | Cons of t * list t
adamc@651:
adamc@651: table t : { Id : int, A : string }
adamc@708: PRIMARY KEY Id
adamc@651:
adamc@651: fun add id s =
adamc@651: dml (INSERT INTO t (Id, A) VALUES ({[id]}, {[s]}))
adamc@651:
adamc@651: fun del id =
adamc@651: dml (DELETE FROM t WHERE t.Id = {[id]})
adamc@651:
adamc@651: fun lookup id =
adamc@651: ro <- oneOrNoRows (SELECT t.A FROM t WHERE t.Id = {[id]});
adamc@651: case ro of
adamc@651: None => return None
adamc@651: | Some r => return (Some r.T.A)
adamc@651:
adamc@651: fun check ls =
adamc@651: case ls of
adamc@651: Nil => return ()
adamc@651: | Cons (id, ls') =>
adamc@651: ao <- lookup id;
adamc@651: alert (case ao of
adamc@651: None => "Nada"
adamc@651: | Some a => a);
adamc@651: check ls'
adamc@651:
adamc@733: fun action () =
adamc@651: idAdd <- source "";
adamc@651: aAdd <- source "";
adamc@651:
adamc@651: idDel <- source "";
adamc@651:
adamc@651: return
adamc@651:
adamc@651:
adamc@651:
adamc@651:
adamc@651:
adamc@651:
adamc@651:
adamc@651:
adamc@651:
adamc@733:
adamc@733: fun main () = return
adamc@733:
adamc@733: