Mercurial > urweb
annotate tests/urblog.ur @ 2068:b6adfe99bb08
Check realloc's return code to prevent segfault on out of memory condition (Part 2)
author | Sergey Mironov <grrwlf@gmail.com> |
---|---|
date | Sun, 24 Aug 2014 11:56:41 +0400 |
parents | 19e8e3d556d6 |
children |
rev | line source |
---|---|
adam@1443 | 1 table entry : { Id : int, Title : string, Created : time, Author : string, |
adam@1443 | 2 Body : string } |
adam@1443 | 3 PRIMARY KEY Id |
adam@1443 | 4 |
adam@1443 | 5 fun list () = |
adam@1443 | 6 rows <- queryX (SELECT * FROM entry) |
adam@1443 | 7 (fn row => |
adam@1443 | 8 <xml> |
adam@1443 | 9 <div> |
adam@1443 | 10 <h1>{[row.Entry.Title]}</h1><br /> |
adam@1443 | 11 <h2>By {[row.Entry.Author]} at {[row.Entry.Created]}</h2> |
adam@1443 | 12 <p>{[row.Entry.Body]}</p> |
adam@1443 | 13 </div> |
adam@1443 | 14 </xml> |
adam@1443 | 15 ); |
adam@1443 | 16 return |
adam@1443 | 17 <xml> |
adam@1443 | 18 <head> |
adam@1443 | 19 <title>All Entries</title> |
adam@1443 | 20 </head> |
adam@1443 | 21 <body> |
adam@1443 | 22 <h1>All Entries</h1> |
adam@1443 | 23 {rows} |
adam@1443 | 24 </body> |
adam@1443 | 25 </xml> |
adam@1443 | 26 |
adam@1443 | 27 fun main () = return <xml> |
adam@1443 | 28 <head> |
adam@1443 | 29 <title>UrBlog</title> |
adam@1443 | 30 </head> |
adam@1443 | 31 |
adam@1443 | 32 <body> |
adam@1443 | 33 <h1>UrBlog</h1> |
adam@1443 | 34 </body> |
adam@1443 | 35 </xml> |