diff options
author | zeripath <art27@cantab.net> | 2020-09-18 15:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-18 17:38:46 +0300 |
commit | 54ae4485881664715d615037f1ab48d50044b0a0 (patch) | |
tree | 685b1d8eb644b8f3c01324fce3e7cdb63bd27283 /vendor/github.com/lib/pq/copy.go | |
parent | 7250f5342f9e48221180c8438d7049097b6e6dfa (diff) | |
download | gitea-54ae4485881664715d615037f1ab48d50044b0a0.tar.gz gitea-54ae4485881664715d615037f1ab48d50044b0a0.zip |
Switch to absolute latest pq driver (#12859)
This PR updates the lib/pq driver to the current master head to
pick up the deadlock fix in lib/pq#993
Hopefully this will resolve our CI issues.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'vendor/github.com/lib/pq/copy.go')
-rw-r--r-- | vendor/github.com/lib/pq/copy.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/vendor/github.com/lib/pq/copy.go b/vendor/github.com/lib/pq/copy.go index d3bc1edd86..9d4f850c3e 100644 --- a/vendor/github.com/lib/pq/copy.go +++ b/vendor/github.com/lib/pq/copy.go @@ -49,6 +49,7 @@ type copyin struct { buffer []byte rowData chan []byte done chan bool + driver.Result closed bool @@ -151,6 +152,8 @@ func (ci *copyin) resploop() { switch t { case 'C': // complete + res, _ := ci.cn.parseComplete(r.string()) + ci.setResult(res) case 'N': if n := ci.cn.noticeHandler; n != nil { n(parseError(&r)) @@ -201,6 +204,22 @@ func (ci *copyin) setError(err error) { ci.Unlock() } +func (ci *copyin) setResult(result driver.Result) { + ci.Lock() + ci.Result = result + ci.Unlock() +} + +func (ci *copyin) getResult() driver.Result { + ci.Lock() + result := ci.Result + ci.Unlock() + if result == nil { + return driver.RowsAffected(0) + } + return result +} + func (ci *copyin) NumInput() int { return -1 } @@ -231,7 +250,11 @@ func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) { } if len(v) == 0 { - return driver.RowsAffected(0), ci.Close() + if err := ci.Close(); err != nil { + return driver.RowsAffected(0), err + } + + return ci.getResult(), nil } numValues := len(v) |