annotate 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
rev   line source
adamc@325 1 table t1 : {Id : int, A : int, B : string, C : float, D : bool}
adamc@325 2
adamc@325 3 open Crud.Make(struct
adamc@339 4 con cols :: {(Type * Type)} = [
adamc@339 5 A = (int, string),
adamc@339 6 B = (string, string),
adamc@339 7 C = (float, string),
adamc@339 8 D = (bool, string)
adamc@339 9 ]
adamc@339 10
adamc@325 11 val tab = t1
adamc@325 12
adamc@325 13 val title = "Crud1"
adamc@325 14
adamc@325 15 val cols = {
adamc@339 16 A = {
adamc@339 17 Nam = "A",
adamc@339 18 Show = txt _,
adamc@339 19 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@339 20 Parse = readError _,
adamc@339 21 Inject = sql_int
adamc@339 22 },
adamc@339 23 B = {
adamc@339 24 Nam = "B",
adamc@339 25 Show = txt _,
adamc@339 26 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@339 27 Parse = readError _,
adamc@339 28 Inject = sql_string
adamc@339 29 },
adamc@339 30 C = {
adamc@339 31 Nam = "C",
adamc@339 32 Show = txt _,
adamc@339 33 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@339 34 Parse = readError _,
adamc@339 35 Inject = sql_float
adamc@339 36 },
adamc@339 37 D = {
adamc@339 38 Nam = "D",
adamc@339 39 Show = txt _,
adamc@339 40 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@339 41 Parse = readError _,
adamc@339 42 Inject = sql_bool
adamc@339 43 }
adamc@325 44 }
adamc@325 45 end)