101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
(curr-secs (current-seconds)))
(if (> (- curr-secs last-update) 3)
(begin
(sync-proc last-update)
;; MOVE THIS CALL TO INSIDE THE sync-proc CALL
(dbr:dbstruct-last-update-set! dbstruct curr-secs)
)))
(assert (sqlite3:database? dbh) "FATAL: bad db handle in dbmod:with-db")
(if use-mutex (mutex-lock! *db-with-db-mutex*))
(let* ((res (apply proc dbdat dbh params)))
(if use-mutex (mutex-unlock! *db-with-db-mutex*))
res)))
|
<
|
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
(curr-secs (current-seconds)))
(if (> (- curr-secs last-update) 3)
(begin
(sync-proc last-update)
;; MOVE THIS CALL TO INSIDE THE sync-proc CALL
(dbr:dbstruct-last-update-set! dbstruct curr-secs)
)))
(assert (sqlite3:database? dbh) "FATAL: bad db handle in dbmod:with-db")
(if use-mutex (mutex-lock! *db-with-db-mutex*))
(let* ((res (apply proc dbdat dbh params)))
(if use-mutex (mutex-unlock! *db-with-db-mutex*))
res)))
|
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
;; if last-update specified ("field-name" . time-in-seconds)
;; then sync only records where field-name >= time-in-seconds
;; IFF field-name exists
;;
;; Use (db:sync-all-tables-list keys) to get the tbls input
;;
(define (dbmod:sync-tables tbls last-update keys fromdb todb)
(assert (sqlite3:database? fromdb) "FATAL: dbmod:sync-tables called with fromdb not a database" fromdb)
(assert (sqlite3:database? todb) "FATAL: dbmod:sync-tables called with fromdb not a database" todb)
(let ((specials `(("keys" "fieldname")
("metadat" "var")
,(cons "runs" (cons "runname" keys))
("tests" "run_id" "testname" "item_path")
("test_meta" "testname")
|
>
|
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
;; if last-update specified ("field-name" . time-in-seconds)
;; then sync only records where field-name >= time-in-seconds
;; IFF field-name exists
;;
;; Use (db:sync-all-tables-list keys) to get the tbls input
;;
(define (dbmod:sync-tables tbls last-update keys fromdb todb)
(debug:print-info 0 *default-log-port* "dbmod:sync-tables called, from: "fromdb", to: "todb)
(assert (sqlite3:database? fromdb) "FATAL: dbmod:sync-tables called with fromdb not a database" fromdb)
(assert (sqlite3:database? todb) "FATAL: dbmod:sync-tables called with fromdb not a database" todb)
(let ((specials `(("keys" "fieldname")
("metadat" "var")
,(cons "runs" (cons "runname" keys))
("tests" "run_id" "testname" "item_path")
("test_meta" "testname")
|
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
(begin
;; (clean-up-qry from-id)
(qry-proc))
(qry-proc))
(set! num-updates (+ num-updates 1))))))
fields-sans-lu)
(let ((row (get-row from-db from-id))) ;; need to insert the row
;; (debug:print 0 *default-log-port* "row="row)
(set! num-inserts (+ num-inserts 1))
(ins-row to-db from-id row))))
from-ids)))))
(+ num-inserts num-updates)))
;; (for-each ;; table
;; (lambda (tabledat)
|
|
|
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
(begin
;; (clean-up-qry from-id)
(qry-proc))
(qry-proc))
(set! num-updates (+ num-updates 1))))))
fields-sans-lu)
(let ((row (get-row from-db from-id))) ;; need to insert the row
(debug:print 0 *default-log-port* "from-id="from-id", to-ids="to-ids", row="row)
(set! num-inserts (+ num-inserts 1))
(ins-row to-db from-id row))))
from-ids)))))
(+ num-inserts num-updates)))
;; (for-each ;; table
;; (lambda (tabledat)
|