Skip to content

Commit 2954ddc

Browse files
committed
Change minimum size of LONG_DATA to 64byte
1 parent 40352b0 commit 2954ddc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packets.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,10 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
912912
const minPktLen = 4 + 1 + 4 + 1 + 4
913913
mc := stmt.mc
914914

915-
longDataSize := mc.maxAllowedPacket / stmt.paramCount
916-
if longDataSize < 16 {
917-
longDataSize = 16
915+
// Determine threshould dynamically to avoid packet size shortage as possible.
916+
longDataSize := mc.maxAllowedPacket / (stmt.paramCount + 1)
917+
if longDataSize < 64 {
918+
longDataSize = 64
918919
}
919920

920921
// Reset packet-sequence

0 commit comments

Comments
 (0)