update vendor/ dir to latest w/o heroku, moby

had to lock a lot of things in place
This commit is contained in:
Reed Allman
2017-08-03 02:38:15 -07:00
parent 780791da1c
commit 30f3c45dbc
5637 changed files with 191713 additions and 1133103 deletions

View File

@@ -167,7 +167,7 @@ type SQLiteDriver struct {
// SQLiteConn implement sql.Conn.
type SQLiteConn struct {
dbMu sync.Mutex
mu sync.Mutex
db *C.sqlite3
loc *time.Location
txlock string
@@ -202,6 +202,7 @@ type SQLiteRows struct {
cols []string
decltype []string
cls bool
closed bool
done chan struct{}
}
@@ -599,6 +600,8 @@ func errorString(err Error) string {
// "deferred", "exclusive".
// _foreign_keys=X
// Enable or disable enforcement of foreign keys. X can be 1 or 0.
// _recursive_triggers=X
// Enable or disable recursive triggers. X can be 1 or 0.
func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
if C.sqlite3_threadsafe() == 0 {
return nil, errors.New("sqlite library was not compiled for thread-safe operation")
@@ -608,6 +611,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
txlock := "BEGIN"
busyTimeout := 5000
foreignKeys := -1
recursiveTriggers := -1
pos := strings.IndexRune(dsn, '?')
if pos >= 1 {
params, err := url.ParseQuery(dsn[pos+1:])
@@ -662,6 +666,18 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
}
}
// _recursive_triggers
if val := params.Get("_recursive_triggers"); val != "" {
switch val {
case "1":
recursiveTriggers = 1
case "0":
recursiveTriggers = 0
default:
return nil, fmt.Errorf("Invalid _recursive_triggers: %v", val)
}
}
if !strings.HasPrefix(dsn, "file:") {
dsn = dsn[:pos]
}
@@ -708,6 +724,17 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
return nil, err
}
}
if recursiveTriggers == 0 {
if err := exec("PRAGMA recursive_triggers = OFF;"); err != nil {
C.sqlite3_close_v2(db)
return nil, err
}
} else if recursiveTriggers == 1 {
if err := exec("PRAGMA recursive_triggers = ON;"); err != nil {
C.sqlite3_close_v2(db)
return nil, err
}
}
conn := &SQLiteConn{db: db, loc: loc, txlock: txlock}
@@ -735,9 +762,9 @@ func (c *SQLiteConn) Close() error {
return c.lastError()
}
deleteHandles(c)
c.dbMu.Lock()
c.mu.Lock()
c.db = nil
c.dbMu.Unlock()
c.mu.Unlock()
runtime.SetFinalizer(c, nil)
return nil
}
@@ -746,8 +773,8 @@ func (c *SQLiteConn) dbConnOpen() bool {
if c == nil {
return false
}
c.dbMu.Lock()
defer c.dbMu.Unlock()
c.mu.Lock()
defer c.mu.Unlock()
return c.db != nil
}
@@ -878,6 +905,7 @@ func (s *SQLiteStmt) query(ctx context.Context, args []namedValue) (driver.Rows,
cols: nil,
decltype: nil,
cls: s.cls,
closed: false,
done: make(chan struct{}),
}
@@ -950,9 +978,10 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result
// Close the rows.
func (rc *SQLiteRows) Close() error {
if rc.s.closed {
if rc.s.closed || rc.closed {
return nil
}
rc.closed = true
if rc.done != nil {
close(rc.done)
}