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) (define (post-comments p)
(local [(define (row->comment a-row) (local [(define (row->comment a-row)
(vector-ref a-row 0)) (vector-ref a-row 0))
(define rows (sqlite:select (define rows
(blog-db (post-blog p)) (sqlite:select
(format "SELECT content FROM comments WHERE pid = '~a'" (blog-db (post-blog p))
(post-id p))))] (format "SELECT content FROM comments WHERE pid = '~a'"
(post-id p))))]
(cond (cond
[(empty? rows) empty] [(empty? rows) empty]
[else (map row->comment (rest rows))]))) [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)) (define the-blog (make-blog db))
(with-handlers ([exn? void]) (with-handlers ([exn? void])
(sqlite:exec/ignore db (sqlite:exec/ignore db
(string-append (string-append
"CREATE TABLE posts" "CREATE TABLE posts "
"(id INTEGER PRIMARY KEY," "(id INTEGER PRIMARY KEY,"
"title TEXT, body TEXT)")) "title TEXT, body TEXT)"))
(blog-insert-post! (blog-insert-post!
the-blog "First Post" "This is my first post") the-blog "First Post" "This is my first post")
(blog-insert-post! (blog-insert-post!
the-blog "Second Post" "This is another post") the-blog "Second Post" "This is another post")
(sqlite:exec/ignore (sqlite:exec/ignore
db "CREATE TABLE comments (pid INTEGER, content TEXT)") db "CREATE TABLE comments (pid INTEGER, content TEXT)")
(post-insert-comment! (post-insert-comment!
the-blog (first (blog-posts the-blog)) the-blog (first (blog-posts the-blog))
"First comment!")) "First comment!"))
the-blog) the-blog)