Skip to content

Commit

Permalink
fix ComStmtSendLongData
Browse files Browse the repository at this point in the history
  • Loading branch information
jackysp committed Aug 24, 2018
1 parent 3ff237c commit 670fee7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/conn_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ func parseStmtArgs(args []interface{}, boundParams [][]byte, nullBitmap, paramTy
args[i] = nil
continue
}
if boundParams[i] != nil {
args[i] = boundParams[i]
if boundParamLength := len(boundParams[i]); boundParamLength != 0 {
// Trim out the last ending byte.
args[i] = boundParams[i][:boundParamLength-1]
continue
}

Expand Down Expand Up @@ -509,7 +510,8 @@ func (cc *clientConn) handleStmtSendLongData(data []byte) (err error) {
}

paramID := int(binary.LittleEndian.Uint16(data[4:6]))
return stmt.AppendParam(paramID, data[6:])
// Append an extra 0 to the end to distinguish no data and no parameter.
return stmt.AppendParam(paramID, append(data[6:], 0))
}

func (cc *clientConn) handleStmtReset(data []byte) (err error) {
Expand Down

0 comments on commit 670fee7

Please sign in to comment.