127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
+
|
(let* ((dbdat (make-dbr:dbdat
dbfile: (dbr:dbstruct-dbfile dbstruct)
dbh: (dbr:dbstruct-inmem dbstruct)
)))
(dbr:dbstruct-dbdat-set! dbstruct dbdat)
dbdat)))
;; NOT USED?
(define (dbmod:need-on-disk-db-handle)
(case (dbfile:cache-method)
((none tmp) #t)
((inmem)
(case (dbfile:sync-method)
((original) #t)
((attach) #t) ;; we need it to force creation of the on-disk file - FIXME
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
-
+
|
(tmpdir (conc "/tmp/"(current-user-name)))
(tmpdb (let* ((fname (conc tmpdir"/" (string-translate areapath "/" ".")"-"(current-process-id)"-"dbfname)))
(if (not (file-exists? tmpdir))(create-directory tmpdir))
;; check if tmpdb already exists, either delete it or
;; add something to the name
fname))
(inmem (dbmod:open-inmem-db init-proc
(if (eq? (dbcache-mode) 'inmem)
(if (eq? (dbfile:cache-method) 'inmem)
#f
tmpdb)
))
(write-access (file-write-access? dbpath))
(db (dbmod:safely-open-db dbfullname init-proc write-access))
(tables (db:sync-all-tables-list keys)))
(if (not (and (sqlite3:database? inmem)
|