This commit is contained in:
2025-07-09 15:45:01 +02:00
parent 466ba16d31
commit 2a9ae580a0

View File

@@ -148,9 +148,9 @@ Below is an example SQLite backend implementation that stores fields in a table:
(require db)
(require racket/vector)
@;{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;}
@;{;; Conversion of field values}
@;{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;}
@; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@; ;; Conversion of field values
@; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (value->string s-expr)
(let ((o (open-output-string)))
@@ -161,9 +161,9 @@ Below is an example SQLite backend implementation that stores fields in a table:
(let ((o (open-input-string str)))
(read o)))
@;{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;}
@;{;; Database storage backend}
@;{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;}
@; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@; ;; Database storage backend
@; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define conn (sqlite3-connect #:database "roos.db" #:mode 'create))
(query-exec conn "CREATE TABLE IF NOT EXISTS store (class TEXT, id TEXT, field TEXT, val TEXT)")
@@ -254,7 +254,7 @@ This example builds an address book with persistent reference to persons, using
)
@;{;; Create sample data}
@; ;; Create sample data
(define b (-! book))
(define (adder n t)
@@ -270,7 +270,7 @@ This example builds an address book with persistent reference to persons, using
(-> b (for-each (lambda (p) (displayln (-> p name)))))
@{;; Reopen addressbook later from persistent storage}
@; ;; Reopen addressbook later from persistent storage
(define a (-! book))
(-> b (for-each (lambda (p) (displayln (-> p name)))))