Commit 8da40ff0 authored by gwenn's avatar gwenn

Sets multi-thread mode for driver by default.

Indeed, the database/sql package ensures that sqlite connections are
used only by on goroutine at a time.
The timeout has been increased to make go-sql-test passed.
parent 4cbd9b68
...@@ -20,6 +20,8 @@ func init() { ...@@ -20,6 +20,8 @@ func init() {
log.Printf("%s: %s, %s\n", d, err, msg) log.Printf("%s: %s, %s\n", d, err, msg)
}, "SQLITE") }, "SQLITE")
} }
ConfigThreadingMode(MultiThread)
ConfigMemStatus(false)
} }
// Adapter to database/sql/driver // Adapter to database/sql/driver
...@@ -41,13 +43,13 @@ type rowsImpl struct { ...@@ -41,13 +43,13 @@ type rowsImpl struct {
// Open opens a new database connection. // Open opens a new database connection.
// ":memory:" for memory db, // ":memory:" for memory db,
// "" for temp file db // "" for temp file db
// TODO How to specify open flags? // TODO How to specify open flags? SQLITE_OPEN_NOMUTEX
func (d *Driver) Open(name string) (driver.Conn, error) { func (d *Driver) Open(name string) (driver.Conn, error) {
c, err := Open(name) c, err := Open(name)
if err != nil { if err != nil {
return nil, err return nil, err
} }
c.BusyTimeout(500) c.BusyTimeout(10000)
return &connImpl{c}, nil return &connImpl{c}, nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment