mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 14:09:13 +00:00
- 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
34 lines
512 B
Go
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)
|
|
}
|
|
}
|