Megatest

Diff
Login

Differences From Artifact [b9031adaf7]:

To Artifact [97344cc733]:


510
511
512
513
514
515
516
517

518
519
520
521



522
523
524
525






526






527
528
529
530
531
532
533
534
535
536
537
538
539








540
541
542
543
544
545
546
510
511
512
513
514
515
516

517
518



519
520
521
522
523
524
525
526
527
528
529
530
531

532
533
534
535
536
537
538
539
540
541
542








543
544
545
546
547
548
549
550
551
552
553
554
555
556
557







-
+

-
-
-
+
+
+




+
+
+
+
+
+
-
+
+
+
+
+
+





-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+







			)))
    (if on-tmp	      ;; done in cautious-open-database
	(begin
	  (sqlite3:execute db "PRAGMA synchronous = 0;")
	  (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000))))
    db))

;; processes table calls
;; mtest processes registry calls

(define (dbfile:insert-or-update-process nsdb pinfdat)
  (let* ((host  (pinf-host pinfdat))
	 (pid   (pinf-pid  pinfdat))
(define (dbfile:insert-or-update-process nsdb dat)
  (let* ((host  (pinf-host dat))
	 (pid   (pinf-pid  dat))
	 (curr-info (dbfile:get-process-info nsdb host pid)))
    (if curr-info ;; record exists, do update
	(match curr-info
	  ((host port pid starttime status purpose dbname mtversion)
	   (sqlite3:execute
	    nsdb
	    "UPDATE processes SET port=?,starttime=?,status=?,
                                  purpose=?,dbname=?,mtversion=?
              WHERE host=? AND pid=?;"
	    (or (pinf-port      dat) port)
	   (dbfile:register-process nsdb host port pid starttime status purpose dbname mtversion))
	    (or (pinf-start     dat) starttime)
	    (or (pinf-status    dat) status)
	    (or (pinf-purpose   dat) purpose)
	    (or (pinf-dbname    dat) dbname)
	    (or (pinf-mtversion dat) mtversion)
	    host pid))
	  (else
	   #f ;; what to do?
	   ))
	(dbfile:register-process
	 nsdb
	 (pinf-host      pinfdat)
	 (pinf-port      pinfdat)
	 (pinf-pid       pinfdat)
	 (pinf-start     pinfdat)
	 (pinf-status    pinfdat)
	 (pinf-purpose   pinfdat)
	 (pinf-dbname    pinfdat)
	 (pinf-mtversion pinfdat)))))
	 (pinf-host      dat)
	 (pinf-port      dat)
	 (pinf-pid       dat)
	 (pinf-start     dat)
	 (pinf-status    dat)
	 (pinf-purpose   dat)
	 (pinf-dbname    dat)
	 (pinf-mtversion dat)))))
	  

(define (dbfile:register-process nsdb host port pid starttime status purpose dbname mtversion)
  (sqlite3:execute nsdb "INSERT INTO processes (host,port,pid,starttime,status,purpose,dbname,mtversion) VALUES (?,?,?,?,?,?,?,?);"
		   host port pid starttime status purpose dbname mtversion))

(define (dbfile:set-process-status nsdb host pid newstatus)