mirror of
https://github.com/safing/portmaster
synced 2025-09-04 03:29:12 +00:00
Fix SQLite maintenance methods
This commit is contained in:
parent
c0d8d0c2f0
commit
2c8ab54104
2 changed files with 11 additions and 0 deletions
|
@ -99,6 +99,7 @@ func openSQLite(name, location string, printStmts bool) (*SQLite, error) {
|
||||||
ctx, cancelCtx := context.WithCancel(context.Background())
|
ctx, cancelCtx := context.WithCancel(context.Background())
|
||||||
return &SQLite{
|
return &SQLite{
|
||||||
name: name,
|
name: name,
|
||||||
|
db: db,
|
||||||
bob: bob.NewDB(db),
|
bob: bob.NewDB(db),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
cancelCtx: cancelCtx,
|
cancelCtx: cancelCtx,
|
||||||
|
|
|
@ -187,6 +187,16 @@ func TestSQLite(t *testing.T) {
|
||||||
t.Fatalf("unexpected purge delete count: %d", n)
|
t.Fatalf("unexpected purge delete count: %d", n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maintenance
|
||||||
|
err = db.Maintain(t.Context())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Maintain: %s", err)
|
||||||
|
}
|
||||||
|
err = db.MaintainThorough(t.Context())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("MaintainThorough: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
// test query
|
// test query
|
||||||
q = query.New("test").MustBeValid()
|
q = query.New("test").MustBeValid()
|
||||||
it, err = db.Query(q, true, true)
|
it, err = db.Query(q, true, true)
|
||||||
|
|
Loading…
Add table
Reference in a new issue