Skip to content

Commit 30e57b5

Browse files
committed
removed deprecated comments, improved my own
1 parent edded4d commit 30e57b5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packets.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,13 +789,13 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
789789

790790
if len(args) > 0 {
791791
pos := minPktLen
792-
// NULL-bitmap [(len(args)+7)/8 bytes]
792+
793793
var nullMask []byte
794794
if maskLen, typesLen := (len(args)+7)/8, 1+2*len(args); pos+maskLen+typesLen >= len(data) {
795-
// buffer has to be extended but we don't know by how much
796-
// so we depend on append after nullMask fits.
797-
// The default size didn't suffice and we have to deal with a lot of columns,
798-
// so allocation size is hard to guess.
795+
// buffer has to be extended but we don't know by how much so
796+
// we depend on append after all data with known sizes fit.
797+
// We stop at that because we deal with a lot of columns here
798+
// which makes the required allocation size hard to guess.
799799
tmp := make([]byte, pos+maskLen+typesLen)
800800
copy(tmp[:pos], data[:pos])
801801
data = tmp
@@ -824,7 +824,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
824824
for i, arg := range args {
825825
// build NULL-bitmap
826826
if arg == nil {
827-
nullMask[i/8] |= 1 << (uint(i) & 7) // |= 1 << uint(i)
827+
nullMask[i/8] |= 1 << (uint(i) & 7)
828828
paramTypes[i+i] = fieldTypeNULL
829829
paramTypes[i+i+1] = 0x00
830830
continue
@@ -894,7 +894,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
894894
}
895895

896896
// Handle []byte(nil) as a NULL value
897-
nullMask[i/8] |= 1 << (uint(i) & 7) // |= 1 << uint(i)
897+
nullMask[i/8] |= 1 << (uint(i) & 7)
898898
paramTypes[i+i] = fieldTypeNULL
899899
paramTypes[i+i+1] = 0x00
900900

0 commit comments

Comments
 (0)