Random Bits of Open Code

Check-in [449cd12f61]
Login

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

Overview
Comment:Added an assert on dbi:open. Wierd problems...
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:449cd12f616916aff37593a9eb5d8db4aa8a7ba6
User & Date: matt 2018-05-14 06:08:03
Context
2018-05-21
05:29
Fixed bad /tmp format bug check-in: e398fb41ad user: matt tags: trunk
2018-05-14
06:08
Added an assert on dbi:open. Wierd problems... check-in: 449cd12f61 user: matt tags: trunk
2018-05-11
09:43
use more portable names for the /tmp/ areas check-in: 4b007bc17a user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mtutils/mtdb/mtdb.scm.

310
311
312
313
314
315
316


317
318
319
320
321
322
323
324
;; 
(define (mtdb-sqlite3-open path fbase)
  (let* ((fulln   (conc path "/" fbase ".db"))
	 (fexists (file-exists? fulln))
	 ;; (dbtype  'sqlite3) ;; 'sql-de-lite
	 (dbtype  'sql-de-lite)
	 (dbispec `((dbname . ,fulln)))


	 (dbh     (dbi:open dbtype dbispec))
	 (db      (dbi:db-conn dbh)))
    ;; WARNING: Race condition exists here.
       (if (not fexists)
	   (dbi:with-transaction
	    dbh
	    (lambda ()
	      (for-each







>
>
|







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
;; 
(define (mtdb-sqlite3-open path fbase)
  (let* ((fulln   (conc path "/" fbase ".db"))
	 (fexists (file-exists? fulln))
	 ;; (dbtype  'sqlite3) ;; 'sql-de-lite
	 (dbtype  'sql-de-lite)
	 (dbispec `((dbname . ,fulln)))
	 (dbh     (begin ;; I'm seeing wierd problems with sqlite3 trying to open stuff other than strings pointing to files
		    (assert (string? (alist-ref 'dbname dbispec)))
		    (dbi:open dbtype dbispec)))
	 (db      (dbi:db-conn dbh)))
    ;; WARNING: Race condition exists here.
       (if (not fexists)
	   (dbi:with-transaction
	    dbh
	    (lambda ()
	      (for-each