* Lock the database from another connection so that no other can read it: * exclusive locking mode, inside a write transaction.
(dbPath: string)
| 85 | * exclusive locking mode, inside a write transaction. |
| 86 | */ |
| 87 | function lockDatabase(dbPath: string): void { |
| 88 | const holder = new DatabaseSync(dbPath); |
| 89 | holder.exec('PRAGMA locking_mode = EXCLUSIVE'); |
| 90 | holder.exec('BEGIN EXCLUSIVE'); |
| 91 | holder.exec('CREATE TABLE IF NOT EXISTS hold_2795 (x)'); |
| 92 | cleanups.push(() => { holder.exec('ROLLBACK'); holder.close(); }); |
| 93 | } |
| 94 | |
| 95 | function thrownBy(fn: () => unknown): unknown { |
| 96 | try { |
no test coverage detected