Closed
Description
Issue description
The function readUntilEOF of struct mysqlConn did not check if data[0] is 0xff.
If I exec a lock command like ' select id from foo for update ', mysql maybe return a timeout error. Without check, program will wait for read forever.
Example code
// Reads Packets until EOF-Packet or an Error appears. Returns count of Packets read
func (mc *mysqlConn) readUntilEOF() error {
for {
data, err := mc.readPacket()
if err != nil {
return err
}
//check if a error packet
if data[0] == iERR {
//read the error code and error message
//https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
}
// No Err and no EOF Packet
if err == nil && data[0] != iEOF {
continue
}
if err == nil && data[0] == iEOF && len(data) == 5 {
mc.status = readStatus(data[3:])
}
return nil // Err or EOF
}
}
Configuration
go version go1.6.2 darwin/amd64
mysql Ver 14.14 Distrib 5.7.12, for osx10.11 (x86_64) using EditLine wrapper
OS X EI Capitan 10.11.5
Metadata
Metadata
Assignees
Labels
No labels