Mercurial > urweb
annotate demo/more/grid0.ur @ 2063:83bdb52962c9
Check realloc's return code to prevent segfault on out of memoty condition
author | Sergey Mironov <grrwlf@gmail.com> |
---|---|
date | Sat, 23 Aug 2014 11:59:34 +0000 |
parents | f0afe61a6f8b |
children |
rev | line source |
---|---|
adamc@1039 | 1 open Dbgrid |
adamc@1039 | 2 |
adamc@1039 | 3 sequence s |
adamc@1039 | 4 table t : {Id : int, A : int} |
adamc@1039 | 5 PRIMARY KEY Id |
adamc@1039 | 6 |
adamc@1039 | 7 open Make(struct |
adamc@1039 | 8 val tab = t |
adamc@1039 | 9 con key = [Id = _] |
adamc@1039 | 10 |
adamc@1039 | 11 val raw = {Id = {New = nextval s, |
adamc@1039 | 12 Inj = _}, |
adamc@1039 | 13 A = {New = return 0, |
adamc@1039 | 14 Inj = _}} |
adamc@1039 | 15 |
adam@1304 | 16 val cols = {Id = Direct.readOnly [#Id] "Id" Direct.int, |
adam@1304 | 17 A = Direct.editable [#A] "A" Direct.int} |
adamc@1039 | 18 |
adamc@1039 | 19 val aggregates = {} |
adamc@1039 | 20 |
adamc@1039 | 21 val pageLength = None |
adamc@1039 | 22 end) |
adamc@1039 | 23 |
adamc@1039 | 24 fun main () = |
adamc@1039 | 25 grid <- grid; |
adamc@1039 | 26 set (showSelection grid) True; |
adamc@1039 | 27 return <xml> |
adamc@1039 | 28 <head> |
adamc@1039 | 29 <link rel="stylesheet" type="text/css" href="../../grid.css"/> |
adamc@1039 | 30 </head> |
adamc@1039 | 31 <body onload={sync grid}> |
adamc@1039 | 32 {render grid} |
adamc@1039 | 33 </body> |
adamc@1039 | 34 </xml> |