3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
|
(zeroth-point (conc "SELECT " timef "," varfn "," valfn " FROM " tablen " WHERE " varfn "='" fieldname "' AND " timef " < " tstart " LIMIT 1")))
(hash-table-set! res-ht fieldname ;; (fetch-rows (sql db qrystr)))))
(reverse
(sqlite3:fold-row
(lambda (res t var val)
(cons (vector t var val) res))
'() db all-dat-qrystr)))
(let ((zeropt (handle-exceptions
exn
#f
(sqlite3:first-row db all-dat-qrystr))))
(if zeropt ;; NOTE: Add zeropt to the beginning of the list as the list was reversed above.
(hash-table-set! res-ht
fieldname
(cons
(apply vector tstart (cdr zeropt))
(hash-table-ref/default res-ht fieldname '())))))))
fields)
|
|
<
<
|
>
>
|
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
|
(zeroth-point (conc "SELECT " timef "," varfn "," valfn " FROM " tablen " WHERE " varfn "='" fieldname "' AND " timef " < " tstart " LIMIT 1")))
(hash-table-set! res-ht fieldname ;; (fetch-rows (sql db qrystr)))))
(reverse
(sqlite3:fold-row
(lambda (res t var val)
(cons (vector t var val) res))
'() db all-dat-qrystr)))
(let ((zeropt (condition-case
(sqlite3:first-row db all-dat-qrystr)
(exn (busy)(db:generic-error-printout exn "ERROR: database " dbdef
" is locked. Try copying to another location, remove original and copy back.")))))
(if zeropt ;; NOTE: Add zeropt to the beginning of the list as the list was reversed above.
(hash-table-set! res-ht
fieldname
(cons
(apply vector tstart (cdr zeropt))
(hash-table-ref/default res-ht fieldname '())))))))
fields)
|