changeset 992:b825d843b22d

Finalized Orm1 demo
author Adam Chlipala <adamc@hcoop.net>
date Tue, 06 Oct 2009 13:11:03 -0400
parents b132f8620a66
children 10114d7b7477
files demo/more/orm1.ur demo/more/orm1.urp demo/more/prose
diffstat 3 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/demo/more/orm1.ur	Tue Oct 06 10:34:27 2009 -0400
+++ b/demo/more/orm1.ur	Tue Oct 06 13:11:03 2009 -0400
@@ -11,10 +11,12 @@
                     end)
 
 fun action () =
-    r <- T.create {A = 3, B = "Hi"};
-    T.save (r -- #B ++ {B = "Bye"});
+    r1 <- T.create {A = 3, B = "Hi"};
+    T.save (r1 -- #B ++ {B = "Bye"});
+    r2 <- T.create {A = 4, B = "Why"};
+    r3 <- T.create {A = 66, B = "Hi"};
 
-    s <- S.create {C = r.Id, D = 45.67};
+    s <- S.create {C = r1.Id, D = 45.67};
 
     ls <- T.list;
     ls' <- T.search (T.eq T.cols.B.Col "Hi");
@@ -22,6 +24,12 @@
     lsS <- S.list;
     lsS <- List.mapM (fn r => p <- S.cols.C.Parent r; return (r, p)) lsS;
 
+    T.delete r1;
+    T.delete r2;
+    T.delete r3;
+
+    S.delete s;
+
     return <xml><body>
       {List.mapX (fn r => <xml><li> {[r.A]}: {[r.B]}</li></xml>) ls}
       <br/>
--- a/demo/more/orm1.urp	Tue Oct 06 10:34:27 2009 -0400
+++ b/demo/more/orm1.urp	Tue Oct 06 13:11:03 2009 -0400
@@ -1,6 +1,6 @@
 library orm
-database dbname=orm1
-sql orm1.sql
+database dbname=test
+sql test.sql
 
 $/list
 orm1
--- a/demo/more/prose	Tue Oct 06 10:34:27 2009 -0400
+++ b/demo/more/prose	Tue Oct 06 13:11:03 2009 -0400
@@ -2,6 +2,10 @@
 
 dragList.urp
 
-This is an Ur/Web version of the "draggable lists" <a href="http://groups.inf.ed.ac.uk/links/examples/">demo program from Links</a>.
+<p>This is an Ur/Web version of the "draggable lists" <a href="http://groups.inf.ed.ac.uk/links/examples/">demo program from Links</a>.</p>
 
 grid1.urp
+
+orm1.urp
+
+<p>Many varieties of "object-relational mapping" (ORM) can be implemented as libraries in Ur/Web, as this demo shows.</p>