diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2017-02-12 22:24:33 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-02-12 22:24:33 +0000 |
commit | ba4840c52becf73c2749c9ef0f2f09ed0b9d5c7f (patch) | |
tree | 61b839884d66c9dd8269e26117aa4e4c995ad119 /vendor/github.com/mattn/go-sqlite3/sqlite3.go | |
parent | 6e00d0000e54f21a4a393e67fd914bda4d394f4a (diff) |
Update dependencies
Diffstat (limited to 'vendor/github.com/mattn/go-sqlite3/sqlite3.go')
-rw-r--r-- | vendor/github.com/mattn/go-sqlite3/sqlite3.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3.go b/vendor/github.com/mattn/go-sqlite3/sqlite3.go index 64933f1..f5699e4 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3.go @@ -429,6 +429,7 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []namedValue) if s.(*SQLiteStmt).s != nil { na := s.NumInput() if len(args) < na { + s.Close() return nil, fmt.Errorf("Not enough args to execute query. Expected %d, got %d.", na, len(args)) } for i := 0; i < na; i++ { @@ -765,14 +766,18 @@ func (s *SQLiteStmt) query(ctx context.Context, args []namedValue) (driver.Rows, done: make(chan struct{}), } - go func() { + go func(db *C.sqlite3) { select { case <-ctx.Done(): - C.sqlite3_interrupt(s.c.db) - rows.Close() + select { + case <-rows.done: + default: + C.sqlite3_interrupt(s.c.db) + rows.Close() + } case <-rows.done: } - }() + }(s.c.db) return rows, nil } @@ -808,13 +813,13 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result done := make(chan struct{}) defer close(done) - go func() { + go func(db *C.sqlite3) { select { case <-ctx.Done(): - C.sqlite3_interrupt(s.c.db) + C.sqlite3_interrupt(db) case <-done: } - }() + }(s.c.db) var rowid, changes C.longlong rv := C._sqlite3_step(s.s, &rowid, &changes) |