504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
|
(debug:print 0 " status: " ((condition-property-accessor 'sqlite3 'status) exn))
(debug:print 0 " src db: " (db:dbdat-get-path fromdb))
(for-each (lambda (dbdat)
(debug:print 0 " dbpath: " (db:dbdat-get-path dbdat)))
(cons todb slave-dbs))
(if *server-run* ;; we are inside a server, throw a sync-failed error
(signal (make-composite-condition
(make-property-condition 'sync-failed 'message "db:sync-tables failed in a server context.")))))
;; (set! *time-to-exit* #t) ;; let watch dog know that it is time to die.
;; (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "shutting-down")
;; (portlogger:open-run-close portlogger:set-port port "released")
;; (exit 1)))
(cond
((not fromdb) (debug:print 3 "WARNING: db:sync-tables called with fromdb missing") -1)
|
|
>
|
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
|
(debug:print 0 " status: " ((condition-property-accessor 'sqlite3 'status) exn))
(debug:print 0 " src db: " (db:dbdat-get-path fromdb))
(for-each (lambda (dbdat)
(debug:print 0 " dbpath: " (db:dbdat-get-path dbdat)))
(cons todb slave-dbs))
(if *server-run* ;; we are inside a server, throw a sync-failed error
(signal (make-composite-condition
(make-property-condition 'sync-failed 'message "db:sync-tables failed in a server context.")))
0)) ;; return zero for num synced
;; (set! *time-to-exit* #t) ;; let watch dog know that it is time to die.
;; (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "shutting-down")
;; (portlogger:open-run-close portlogger:set-port port "released")
;; (exit 1)))
(cond
((not fromdb) (debug:print 3 "WARNING: db:sync-tables called with fromdb missing") -1)
|
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
|
(db:dbdat-get-db fromdb)
full-sel)
;; tack on remaining records in fromdat
(if (not (null? fromdat))
(set! fromdats (cons fromdat fromdats)))
(debug:print-info 2 "found " totrecords " records to sync")
;; read the target table
(sqlite3:for-each-row
(lambda (a . b)
(hash-table-set! todat a (apply vector a b)))
(db:dbdat-get-db todb)
full-sel)
|
|
|
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
|
(db:dbdat-get-db fromdb)
full-sel)
;; tack on remaining records in fromdat
(if (not (null? fromdat))
(set! fromdats (cons fromdat fromdats)))
(debug:print-info 4 "found " totrecords " records to sync")
;; read the target table
(sqlite3:for-each-row
(lambda (a . b)
(hash-table-set! todat a (apply vector a b)))
(db:dbdat-get-db todb)
full-sel)
|