Skip to content

Commit

Permalink
Merge pull request #473 from methane/fix-464
Browse files Browse the repository at this point in the history
readUntilEOF should support ERR packet
  • Loading branch information
julienschmidt authored Aug 2, 2016
2 parents 3654d25 + c6f6102 commit 0b58b37
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,19 @@ func (rows *textRows) readRow(dest []driver.Value) error {
func (mc *mysqlConn) readUntilEOF() error {
for {
data, err := mc.readPacket()

// 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:])
if err != nil {
return err
}

return err // Err or EOF
switch data[0] {
case iERR:
return mc.handleErrorPacket(data)
case iEOF:
if len(data) == 5 {
mc.status = readStatus(data[3:])
}
return nil
}
}
}

Expand Down

0 comments on commit 0b58b37

Please sign in to comment.