This commit is contained in:
11
src/sqlite/index.ts
Normal file
11
src/sqlite/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Database, constants } from 'bun:sqlite'
|
||||
|
||||
const db = new Database('db.sqlite', {create: true, strict: true})
|
||||
db.run('PRAGMA journal_mode = WAL;')
|
||||
|
||||
db.fileControl(constants.SQLITE_FCNTL_PERSIST_WAL, 0)
|
||||
// Checkpoint and truncate the WAL file
|
||||
db.run('PRAGMA wal_checkpoint(TRUNCATE);')
|
||||
db.close()
|
||||
|
||||
const query = db.query(`select "Hello world" as message`)
|
||||
Reference in New Issue
Block a user