Megatest

Diff
Login

Differences From Artifact [d2c04b8411]:

To Artifact [10f6820556]:


191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
     db "SELECT val FROM metadat WHERE var=?;" var)
    (if (string? res)
	(let ((valnum (string->number res)))
	  (if valnum valnum res))
	res)))

(define (db:set-var db var val)
  ;; Odd, I thought that if a constraint was placed on column then an insert with duplicate data
  ;; would fail and the insert would fall back to replace.
  ;; NB// accidently included primary key in the unique constraint which does not work.
  (let ((have (db:get-var db var)))
    ;; (if have
    ;; (sqlite3:execute db "UPDATE metadat SET val=? WHERE var=?;" val var)
	(sqlite3:execute db "INSERT OR REPLACE INTO metadat (var,val) VALUES (?,?);" var val)))

;; use a global for some primitive caching, it is just silly to re-read the db 
;; over and over again for the keys since they never change

(define *db-keys* #f)

(define (db-get-keys db)







<
<
<
<
<
<
|







191
192
193
194
195
196
197






198
199
200
201
202
203
204
205
     db "SELECT val FROM metadat WHERE var=?;" var)
    (if (string? res)
	(let ((valnum (string->number res)))
	  (if valnum valnum res))
	res)))

(define (db:set-var db var val)






  (sqlite3:execute db "INSERT OR REPLACE INTO metadat (var,val) VALUES (?,?);" var val))

;; use a global for some primitive caching, it is just silly to re-read the db 
;; over and over again for the keys since they never change

(define *db-keys* #f)

(define (db-get-keys db)