31 lines
1.1 KiB
Scheme
31 lines
1.1 KiB
Scheme
|
(import sql-de-lite)
|
||
|
|
||
|
(define (!= x y)
|
||
|
(not (= x y)))
|
||
|
|
||
|
(with-output-to-file "kjv.txt"
|
||
|
(lambda ()
|
||
|
(call-with-database "bible-sqlite.db"
|
||
|
(lambda (db)
|
||
|
(let ((previous-book 0)
|
||
|
(previous-chapter 0)
|
||
|
(previous-verse 0))
|
||
|
(query (for-each-row
|
||
|
(lambda (row)
|
||
|
(let ((book (car row))
|
||
|
(chapter (cadr row))
|
||
|
(verse (caddr row))
|
||
|
(text (cadddr row)))
|
||
|
(when (!= book previous-book)
|
||
|
(display "startofbook\n"))
|
||
|
(when (!= chapter previous-chapter)
|
||
|
(display "startofchapter\n"))
|
||
|
(when (!= verse previous-verse)
|
||
|
(display "startofverse\n"))
|
||
|
(set! previous-book book)
|
||
|
(set! previous-chapter chapter)
|
||
|
(set! previous-verse verse)
|
||
|
(display text)
|
||
|
(newline))))
|
||
|
(sql db "select b,c,v,t from t_kjv")))))))
|