MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / openDatabase

Function openDatabase

apps/desktop/main/worker/import/incrementalImport.ts:32–41  ·  view source on GitHub ↗
(sessionId: string, readonly?: boolean)

Source from the content-addressed store, hash-verified

30function buildDeps(requestId: string): IncrementalImportDeps {
31 return {
32 openDatabase(sessionId: string, readonly?: boolean) {
33 const dbPath = getDbPath(sessionId)
34 if (!fs.existsSync(dbPath)) {
35 throw new Error(`Session database not found: ${sessionId}`)
36 }
37 const db = new Database(dbPath, { readonly })
38 db.pragma('journal_mode = WAL')
39 if (!readonly) db.pragma('synchronous = NORMAL')
40 return new BetterSqliteAdapter(db)
41 },
42 onProgress(progress) {
43 sendProgress(requestId, progress)
44 },

Callers

nothing calls this directly

Calls 2

getDbPathFunction · 0.90
pragmaMethod · 0.65

Tested by

no test coverage detected