File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import "C"
33
33
import (
34
34
"database/sql"
35
35
"database/sql/driver"
36
+ "sync"
36
37
)
37
38
38
39
var (
@@ -45,13 +46,17 @@ func init() {
45
46
46
47
// SQLiteDriver implement sql.Driver.
47
48
type SQLiteDriver struct {
49
+ mu sync.Mutex
48
50
Config * Config
49
51
Extensions []string
50
52
ConnectHook func (* SQLiteConn ) error
51
53
}
52
54
53
55
// Open database and return a new connection.
54
56
func (d * SQLiteDriver ) Open (dsn string ) (driver.Conn , error ) {
57
+ d .mu .Lock ()
58
+ defer d .mu .Unlock ()
59
+
55
60
cfg , err := ParseDSN (dsn )
56
61
if err != nil {
57
62
return nil , err
Original file line number Diff line number Diff line change 22
22
// The two-step sequence allows drivers to parse the name just once and also provides
23
23
// access to per-Conn contexts.
24
24
func (d * SQLiteDriver ) OpenConnector (dsn string ) (driver.Connector , error ) {
25
+ d .mu .Lock ()
26
+ defer d .mu .Unlock ()
27
+
25
28
cfg , err := ParseDSN (dsn )
26
29
if err != nil {
27
30
return nil , err
You can’t perform that action at this time.
0 commit comments