(sessionId: string)
| 28 | * 打开数据库(只读模式,不使用缓存) |
| 29 | */ |
| 30 | export function openReadonlyDatabase(sessionId: string): Database.Database | null { |
| 31 | const dbPath = getDbPath(sessionId) |
| 32 | try { |
| 33 | const db = new Database(dbPath, { readonly: true }) |
| 34 | db.pragma('journal_mode = WAL') |
| 35 | return db |
| 36 | } catch { |
| 37 | return null |
| 38 | } |
| 39 | } |
no test coverage detected