Adjusted indentation.

svn: r11285
This commit is contained in:
Danny Yoo 2008-08-15 20:04:57 +00:00
parent cd03bb635e
commit 5d9410c058
2 changed files with 13 additions and 12 deletions

View File

@ -71,10 +71,11 @@
(define (post-comments p)
(local [(define (row->comment a-row)
(vector-ref a-row 0))
(define rows (sqlite:select
(blog-db (post-blog p))
(format "SELECT content FROM comments WHERE pid = '~a'"
(post-id p))))]
(define rows
(sqlite:select
(blog-db (post-blog p))
(format "SELECT content FROM comments WHERE pid = '~a'"
(post-id p))))]
(cond
[(empty? rows) empty]
[else (map row->comment (rest rows))])))

View File

@ -990,17 +990,17 @@ We can now write the code to initialize a @scheme[blog] structure:
(define the-blog (make-blog db))
(with-handlers ([exn? void])
(sqlite:exec/ignore db
(string-append
"CREATE TABLE posts"
"(id INTEGER PRIMARY KEY,"
"title TEXT, body TEXT)"))
(blog-insert-post!
(string-append
"CREATE TABLE posts "
"(id INTEGER PRIMARY KEY,"
"title TEXT, body TEXT)"))
(blog-insert-post!
the-blog "First Post" "This is my first post")
(blog-insert-post!
(blog-insert-post!
the-blog "Second Post" "This is another post")
(sqlite:exec/ignore
(sqlite:exec/ignore
db "CREATE TABLE comments (pid INTEGER, content TEXT)")
(post-insert-comment!
(post-insert-comment!
the-blog (first (blog-posts the-blog))
"First comment!"))
the-blog)