Files
sqlite3/tests/wal_test.go
Nuno Cruces 11c03a16f9 Implement shared memory WAL. (#71)
- enabled by default on 64-bit macOS and Linux (`amd64`/`arm64`)
- depends on merged but unreleased wazero
- may cause small performance regression
- users may need WithMemoryLimitPages if not enough address space available
- needs docs
2024-04-10 13:15:36 +01:00

34 lines
512 B
Go

package tests
import (
"path/filepath"
"testing"
"github.com/ncruces/go-sqlite3"
)
func TestWAL_enter_exit(t *testing.T) {
t.Parallel()
file := filepath.Join(t.TempDir(), "test.db")
db, err := sqlite3.Open(file)
if err != nil {
t.Fatal(err)
}
defer db.Close()
err = db.Exec(`
CREATE TABLE test (col);
PRAGMA journal_mode=WAL;
SELECT * FROM test;
PRAGMA journal_mode=DELETE;
SELECT * FROM test;
PRAGMA journal_mode=WAL;
SELECT * FROM test;
`)
if err != nil {
t.Fatal(err)
}
}