forked from forgejo/forgejo
Update to latest mssqldriver (#7613)
* New driver does not tolerate USE - handle this by closing db and reopening db in the new dbname
This commit is contained in:
parent
bebc6a3c77
commit
78e5317242
31 changed files with 2376 additions and 598 deletions
20
vendor/github.com/denisenkom/go-mssqldb/net.go
generated
vendored
20
vendor/github.com/denisenkom/go-mssqldb/net.go
generated
vendored
|
@ -14,7 +14,7 @@ type timeoutConn struct {
|
|||
continueRead bool
|
||||
}
|
||||
|
||||
func NewTimeoutConn(conn net.Conn, timeout time.Duration) *timeoutConn {
|
||||
func newTimeoutConn(conn net.Conn, timeout time.Duration) *timeoutConn {
|
||||
return &timeoutConn{
|
||||
c: conn,
|
||||
timeout: timeout,
|
||||
|
@ -48,9 +48,11 @@ func (c *timeoutConn) Read(b []byte) (n int, err error) {
|
|||
n, err = c.buf.Read(b)
|
||||
return
|
||||
}
|
||||
err = c.c.SetDeadline(time.Now().Add(c.timeout))
|
||||
if err != nil {
|
||||
return
|
||||
if c.timeout > 0 {
|
||||
err = c.c.SetDeadline(time.Now().Add(c.timeout))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return c.c.Read(b)
|
||||
}
|
||||
|
@ -58,7 +60,7 @@ func (c *timeoutConn) Read(b []byte) (n int, err error) {
|
|||
func (c *timeoutConn) Write(b []byte) (n int, err error) {
|
||||
if c.buf != nil {
|
||||
if !c.packetPending {
|
||||
c.buf.BeginPacket(packPrelogin)
|
||||
c.buf.BeginPacket(packPrelogin, false)
|
||||
c.packetPending = true
|
||||
}
|
||||
n, err = c.buf.Write(b)
|
||||
|
@ -67,9 +69,11 @@ func (c *timeoutConn) Write(b []byte) (n int, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
err = c.c.SetDeadline(time.Now().Add(c.timeout))
|
||||
if err != nil {
|
||||
return
|
||||
if c.timeout > 0 {
|
||||
err = c.c.SetDeadline(time.Now().Add(c.timeout))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return c.c.Write(b)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue