forked from mirror/go-sqlite3
parent
09cb77ebcc
commit
c8d9a4a210
|
@ -33,6 +33,7 @@ import "C"
|
|||
import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -45,6 +46,7 @@ func init() {
|
|||
|
||||
// SQLiteDriver implement sql.Driver.
|
||||
type SQLiteDriver struct {
|
||||
mu sync.Mutex
|
||||
Config *Config
|
||||
Extensions []string
|
||||
ConnectHook func(*SQLiteConn) error
|
||||
|
@ -52,6 +54,9 @@ type SQLiteDriver struct {
|
|||
|
||||
// Open database and return a new connection.
|
||||
func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
|
||||
cfg, err := ParseDSN(dsn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -22,6 +22,9 @@ var (
|
|||
// The two-step sequence allows drivers to parse the name just once and also provides
|
||||
// access to per-Conn contexts.
|
||||
func (d *SQLiteDriver) OpenConnector(dsn string) (driver.Connector, error) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
|
||||
cfg, err := ParseDSN(dsn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue