40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
+
+
+
+
|
ports
commonmod
)
;; (import debugprint)
;; Parameters
(define num-run-dbs (make-parameter 10))
;;======================================================================
;; R E C O R D S
;;======================================================================
;; a single Megatest area with it's multiple dbs is
;; managed in a dbstruct
;;
|
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
-
+
|
(define (db:dbname->path apath dbname)
(conc apath"/"dbname))
;; POTENTIAL BUG: this implementation could produce a db file if run-id is neither #f or a number
(define (dbfile:run-id->dbname run-id)
(cond
((number? run-id) (conc ".megatest/" (modulo run-id 100) ".db"))
((number? run-id) (conc ".megatest/" (modulo run-id (num-run-dbs)) ".db"))
((not run-id) (conc ".megatest/main.db"))
(else run-id)))
;; Make the dbstruct, setup up auxillary db's and call for main db at least once
;;
;; called in http-transport and replicated in rmt.scm for *local* access.
;;
|
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
|
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
|
-
+
+
+
|
(sqlite3:for-each-row
(lambda (a . b)
(set! fromdat (cons (apply vector a b) fromdat))
(if (> (length fromdat) batch-len)
(begin
(set! fromdats (cons fromdat fromdats))
(set! fromdat '())
(set! totrecords (+ totrecords 1)))
(set! totrecords (+ totrecords 1))
(thread-sleep! 2)
)
)
)
(dbr:dbdat-dbh fromdb)
full-sel)
)
)
|