Skip to content

Commit 25a9fdb

Browse files
committed
Allow buffer to increase arbitrarily in size
1 parent bcd52dd commit 25a9fdb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packets.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,17 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
797797
pos++
798798

799799
// type of each parameter [len(args)*2 bytes]
800-
paramTypes := data[pos:]
800+
oldPos := pos
801801
pos += (len(args) << 1)
802802

803+
// extend data as necessary
804+
if pos > len(data) {
805+
data = append(data, make([]byte, pos-len(data))...)
806+
mc.buf.buf = data
807+
}
808+
809+
paramTypes := data[oldPos:]
810+
803811
// value of each parameter [n bytes]
804812
paramValues := data[pos:pos]
805813
valuesCap := cap(paramValues)

0 commit comments

Comments
 (0)