hello, i am having database is locked issue.
i can reproduce in below minimal example. as far as i know a constrain violation should not lock for subsequent operations
can you help me :) ?
thank you
// example.go
package main
import (
"fmt"
"log"
"os"
"github.com/upper/db/v4"
"github.com/upper/db/v4/adapter/sqlite"
)
var settings = sqlite.ConnectionURL{
Database: `example.db`,
}
func main() {
defer os.Remove(`example.db`)
sess, err := sqlite.Open(settings)
if err != nil {
log.Fatalf("db.Open(): %q\n", err)
}
_, err = sess.SQL().Exec(`DROP TABLE IF EXISTS "example1";
create table example1(
id INTEGER PRIMARY KEY AUTOINCREMENT,
slug text not null,
subtype text not null,
description text not null,
group_id text not null,
unique( slug, group_id)
);`)
if err != nil {
log.Fatal(err)
}
//sess.SetMaxOpenConns(1)
defer sess.Close()
for range []int{1, 2, 3} {
Insert(sess)
}
}
func Insert(sess db.Session) {
tbl := sess.Collection("example1")
_, err := tbl.Insert(db.Cond{
"slug": "aa",
"group_id": "g1",
"description": "asas",
"subtype": "asa",
})
fmt.Println(err)
}
hello, i am having database is locked issue. i can reproduce in below minimal example. as far as i know a constrain violation should not lock for subsequent operations can you help me :) ? thank you