diff --git a/connection.go b/connection.go index 9d21f555..93a51b01 100644 --- a/connection.go +++ b/connection.go @@ -344,10 +344,10 @@ func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, erro func (mc *mysqlConn) query(query string, args []driver.Value) (*textRows, error) { handleOk := mc.clearResult() + if mc.closed.Load() { return nil, driver.ErrBadConn } - if len(args) != 0 { if !mc.cfg.InterpolateParams { return nil, driver.ErrSkip diff --git a/packets.go b/packets.go index b5621c92..0dab3837 100644 --- a/packets.go +++ b/packets.go @@ -117,8 +117,8 @@ func (mc *mysqlConn) writePacket(data []byte) error { // Write packet if mc.writeTimeout > 0 { if err := mc.netConn.SetWriteDeadline(time.Now().Add(mc.writeTimeout)); err != nil { - mc.log(err) mc.cleanup() + mc.log(err) return err } }