MCPcopy
hub / github.com/go-sql-driver/mysql / makePacket

Function makePacket

connection_test.go:283–291  ·  view source on GitHub ↗

makePacket wraps a payload in a MySQL protocol packet header.

(seq byte, payload []byte)

Source from the content-addressed store, hash-verified

281
282// makePacket wraps a payload in a MySQL protocol packet header.
283func makePacket(seq byte, payload []byte) []byte {
284 pkt := make([]byte, 4+len(payload))
285 pkt[0] = byte(len(payload))
286 pkt[1] = byte(len(payload) >> 8)
287 pkt[2] = byte(len(payload) >> 16)
288 pkt[3] = seq
289 copy(pkt[4:], payload)
290 return pkt
291}
292
293// TestGetSystemVarBufferReuse verifies that getSystemVar returns a value that
294// is not corrupted by the subsequent skipRows call.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected