Random Bits of Open Code

Check-in [d7beec78b6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make adat-init optionally set up the megatest source area.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d7beec78b6fc8eef900852b2bf85d2648c0517fa
User & Date: matt 2018-05-08 03:37:11
Context
2018-05-08
06:10
Switch order of data returned from get-area-infos. check-in: cfcf6d3c8e user: matt tags: trunk
03:37
Make adat-init optionally set up the megatest source area. check-in: d7beec78b6 user: matt tags: trunk
2018-05-07
02:30
Extend constraint on runs to include area_id. Respect area name provided by dashboard config file. check-in: 6149f777bb user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mtutils/mtdb/mtdb.scm.

242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
...
317
318
319
320
321
322
323

324
325
326
327
328
329
330

;;======================================================================
;; Manage the /tmp/ db mirror area (use current directory on Windows)
;;======================================================================

;; Need to consolidate this with a very similar call in mtview.scm.
;;
(define (adat-init adat-in #!key (mtpath #f)(area-name #f))
  (let* ((onwin  (common:windows?))
	 (adat   (or adat-in (make-adat)))
	 (aname  (or (adat-name adat)
		     (begin
		       (adat-name-set! adat area-name)
		       area-name)))
	 (apath  (or (adat-path adat)
................................................................................
		     (let* ((p1 (conc tmpbase (current-user-name) "/mtview_cache"))
			    (p2 (conc (string-translate apath "/" "." )))
			    (tpath (conc p1 "/" p2)))
		       (adat-tmp-area-set! adat p1)
		       (adat-tmppath-set! adat tpath)
		       tpath))))
    (if (not (directory-exists? tmppth))(create-directory tmppth #t))
    (if (and (file-read-access? mtdb)(file-read-access? mtcfg)(file-read-access? rccfg))
	(begin
	  (if (not (adat-mtconfig adat))
	      (adat-mtconfig-set! adat (configf:read-config mtcfg #f #f)))
	  (if (not (adat-runconfig adat))
	      (adat-runconfig-set! adat (configf:read-config rccfg #f #f)))))
    adat))

................................................................................
       (dbi:exec dbh "PRAGMA journal_mode=WAL")
       (dbi:exec dbh "PRAGMA synchronous=0")
       dbh))

;; do NOT close the db in the following three routines.

;; for sql-de-lite access we keep main and runs in separate files

;;
(define (with-common-db adat proc . params)
  (let* ((dbh-main (if (adat-common-db adat)
		       (adat-common-db adat)
		       (let* ((tmp-area (adat-tmp-area adat))
			      (dbh     (mtdb-sqlite3-open tmp-area "common")))
			 (adat-tmp-area-set!  adat tmp-area)







|







 







|







 







>







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
...
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331

;;======================================================================
;; Manage the /tmp/ db mirror area (use current directory on Windows)
;;======================================================================

;; Need to consolidate this with a very similar call in mtview.scm.
;;
(define (adat-init adat-in #!key (mtpath #f)(area-name #f)(use-mt-area #t))
  (let* ((onwin  (common:windows?))
	 (adat   (or adat-in (make-adat)))
	 (aname  (or (adat-name adat)
		     (begin
		       (adat-name-set! adat area-name)
		       area-name)))
	 (apath  (or (adat-path adat)
................................................................................
		     (let* ((p1 (conc tmpbase (current-user-name) "/mtview_cache"))
			    (p2 (conc (string-translate apath "/" "." )))
			    (tpath (conc p1 "/" p2)))
		       (adat-tmp-area-set! adat p1)
		       (adat-tmppath-set! adat tpath)
		       tpath))))
    (if (not (directory-exists? tmppth))(create-directory tmppth #t))
    (if (and use-mt-area (file-read-access? mtdb)(file-read-access? mtcfg)(file-read-access? rccfg))
	(begin
	  (if (not (adat-mtconfig adat))
	      (adat-mtconfig-set! adat (configf:read-config mtcfg #f #f)))
	  (if (not (adat-runconfig adat))
	      (adat-runconfig-set! adat (configf:read-config rccfg #f #f)))))
    adat))

................................................................................
       (dbi:exec dbh "PRAGMA journal_mode=WAL")
       (dbi:exec dbh "PRAGMA synchronous=0")
       dbh))

;; do NOT close the db in the following three routines.

;; for sql-de-lite access we keep main and runs in separate files
;; if called with adat=#f then 
;;
(define (with-common-db adat proc . params)
  (let* ((dbh-main (if (adat-common-db adat)
		       (adat-common-db adat)
		       (let* ((tmp-area (adat-tmp-area adat))
			      (dbh     (mtdb-sqlite3-open tmp-area "common")))
			 (adat-tmp-area-set!  adat tmp-area)