8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
;; PURPOSE.
;;======================================================================
;; The meta data key store, just a general dumping ground for values
;; only used occasionally
;;======================================================================
(declare (unit keystore))
(define (keystore:get db key)
(dbi:get-one db "SELECT value FROM metadata WHERE key=?;" key))
(define (keystore:set! db key value)
(let ((curr-val (keystore:get db key)))
(if curr-val
(dbi:exec db "UPDATE metadata SET value=? WHERE key=?;" value key)
(dbi:exec db "INSERT INTO metadata (key,value) VALUES (?,?);" key value))))
(define (keystore:del! db key)
(dbi:exec db "DELETE FROM metadata WHERE key=?;" key))
|
|
>
>
>
>
>
>
>
>
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
;; PURPOSE.
;;======================================================================
;; The meta data key store, just a general dumping ground for values
;; only used occasionally
;;======================================================================
;; (declare (unit keystore))
(module keystore
*
(import chicken scheme data-structures extras srfi-13 ports )
(define (keystore:get db key)
(dbi:get-one db "SELECT value FROM metadata WHERE key=?;" key))
(define (keystore:set! db key value)
(let ((curr-val (keystore:get db key)))
(if curr-val
(dbi:exec db "UPDATE metadata SET value=? WHERE key=?;" value key)
(dbi:exec db "INSERT INTO metadata (key,value) VALUES (?,?);" key value))))
(define (keystore:del! db key)
(dbi:exec db "DELETE FROM metadata WHERE key=?;" key))
)
|