changeset 300:cde1ec47f3af

Elaborated 'update'
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 13:51:07 -0400
parents 5f6a60b7ab00
children 54282db31a9b
files lib/basis.urs src/urweb.grm tests/update.ur tests/update.urp
diffstat 4 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/basis.urs	Sun Sep 07 13:47:10 2008 -0400
+++ b/lib/basis.urs	Sun Sep 07 13:51:07 2008 -0400
@@ -209,8 +209,8 @@
         -> dml
 
 val update : changed ::: {Type} -> unchanged ::: {Type} -> changed ~ unchanged
+        -> $changed
         -> sql_table (changed ++ unchanged)
-        -> $changed
         -> sql_exp [T = changed ++ unchanged] [] [] bool
         -> dml
 
--- a/src/urweb.grm	Sun Sep 07 13:47:10 2008 -0400
+++ b/src/urweb.grm	Sun Sep 07 13:51:07 2008 -0400
@@ -726,6 +726,7 @@
                                                (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))),
                                          s (XML_BEGINleft, XML_ENDright))
        | LPAREN query RPAREN            (query)
+       | LPAREN CWHERE sqlexp RPAREN    (sqlexp)
        | UNDER                          (EWild, s (UNDERleft, UNDERright))
 
 idents : ident                          ([ident])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/update.ur	Sun Sep 07 13:51:07 2008 -0400
@@ -0,0 +1,5 @@
+table t1 : {A : int, B : string, C : float, D : bool}
+
+fun main () : transaction page =
+        () <- dml (update {B = "6", C = 7.0} t1 (WHERE T.A = 5));
+        return <html><body>Updated.</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/update.urp	Sun Sep 07 13:51:07 2008 -0400
@@ -0,0 +1,6 @@
+debug
+database dbname=test
+exe /tmp/webapp
+sql /tmp/urweb.sql
+
+update