aboutsummaryrefslogtreecommitdiffstats
path: root/src/convert.scm
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-12-28 22:03:55 +0100
committerGravatar Tom Willemsen2012-12-28 22:03:55 +0100
commite3d4594eb7a2f9db7fc31ec0cc5ae119be3fa55a (patch)
tree9fde317ed7adf7e57f82bf560d7cdeedc73af959 /src/convert.scm
parente72e942eca4690e8c733ac9fdafeac9b33c9f3f4 (diff)
downloadmarkam-e3d4594eb7a2f9db7fc31ec0cc5ae119be3fa55a.tar.gz
markam-e3d4594eb7a2f9db7fc31ec0cc5ae119be3fa55a.zip
Add/improve some documentation comments
Since CHICKEN scheme doesn't do docstrings I'm just using comments.
Diffstat (limited to 'src/convert.scm')
-rw-r--r--src/convert.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/convert.scm b/src/convert.scm
index 3229823..99f42b7 100644
--- a/src/convert.scm
+++ b/src/convert.scm
@@ -28,11 +28,18 @@
(require-library srfi-4)
(define (blob->seconds blob)
+ ;; Convert BLOB to an integer representing the seconds since
+ ;; 01-01-1970 (standard unix timstamp). This has to be done because
+ ;; in the previous version of linkwave I stored the timestamp as a
+ ;; blob and CHICKEN doesn't seem to like blobs much.
(if (u32vector? blob)
(u32vector-ref (blob->u32vector blob) 0)
0))
(define (convert-table db name converter #!optional select)
+ ;; Convert NAME from DB using CONVERTER for each specific row. The
+ ;; optional SELECT should be an SQL query that will be used to fetch
+ ;; the rows to convert.
(let ((count (first-result db (string-append "SELECT COUNT(*) FROM " name)))
(progress 0))
(for-each-row (lambda args
@@ -43,6 +50,8 @@
(newline)))
(define (convert)
+ ;; Convert an old database into a new one and then replace the old
+ ;; with the new.
(let ((old-db (open-database (data-file "linkwave.db")))
(new-db (open-database (data-file "nlinkwave.db"))))
(execute new-db "CREATE TABLE bookmark (url VARCHAR(255) UNIQUE, date INTEGER, name VARCHAR(255), description TEXT)")