diff tests/crud1.ur @ 339:075b36dbb1a4

Crud supports INSERT
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 15:10:04 -0400
parents 34847732cefc
children 389399d65331
line wrap: on
line diff
--- a/tests/crud1.ur	Sun Sep 14 11:02:18 2008 -0400
+++ b/tests/crud1.ur	Sun Sep 14 15:10:04 2008 -0400
@@ -1,14 +1,45 @@
 table t1 : {Id : int, A : int, B : string, C : float, D : bool}
 
 open Crud.Make(struct
+        con cols :: {(Type * Type)} = [
+                A = (int, string),
+                B = (string, string),
+                C = (float, string),
+                D = (bool, string)
+        ]
+
         val tab = t1
 
         val title = "Crud1"
 
         val cols = {
-                A = {Nam = "A", Show = txt _},
-                B = {Nam = "B", Show = txt _},
-                C = {Nam = "C", Show = txt _},
-                D = {Nam = "D", Show = txt _}
+                A = {
+                        Nam = "A",
+                        Show = txt _,
+                        Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
+                        Parse = readError _,
+                        Inject = sql_int
+                    },
+                B = {
+                        Nam = "B",
+                        Show = txt _,
+                        Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
+                        Parse = readError _,
+                        Inject = sql_string
+                    },
+                C = {
+                        Nam = "C",
+                        Show = txt _,
+                        Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
+                        Parse = readError _,
+                        Inject = sql_float
+                    },
+                D = {
+                        Nam = "D",
+                        Show = txt _,
+                        Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
+                        Parse = readError _,
+                        Inject = sql_bool
+                    }
         }
 end)