Skip to content

Support receiving ERR packet while reading rows #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,13 @@ func (rows *textRows) readRow(dest []driver.Value) error {

// EOF Packet
if data[0] == iEOF && len(data) == 5 {
rows.mc = nil
return io.EOF
}
if data[0] == iERR {
rows.mc = nil
return mc.handleErrorPacket(data)
}

// RowSet Packet
var n int
Expand Down Expand Up @@ -968,6 +973,7 @@ func (rows *binaryRows) readRow(dest []driver.Value) error {

// packet indicator [1 byte]
if data[0] != iOK {
rows.mc = nil
// EOF Packet
if data[0] == iEOF && len(data) == 5 {
return io.EOF
Expand Down
10 changes: 2 additions & 8 deletions rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ func (rows *binaryRows) Next(dest []driver.Value) error {
}

// Fetch next row from stream
if err := rows.readRow(dest); err != io.EOF {
return err
}
rows.mc = nil
return rows.readRow(dest)
}
return io.EOF
}
Expand All @@ -87,10 +84,7 @@ func (rows *textRows) Next(dest []driver.Value) error {
}

// Fetch next row from stream
if err := rows.readRow(dest); err != io.EOF {
return err
}
rows.mc = nil
return rows.readRow(dest)
}
return io.EOF
}
Expand Down