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

Function readLengthEncodedString

utils.go:530–544  ·  view source on GitHub ↗

returns the string read as a bytes slice, whether the value is NULL, the number of bytes read and an error, in case the string is longer than the input slice

(b []byte)

Source from the content-addressed store, hash-verified

528// the number of bytes read and an error, in case the string is longer than
529// the input slice
530func readLengthEncodedString(b []byte) ([]byte, bool, int, error) {
531 // Get length
532 num, isNull, n := readLengthEncodedInteger(b)
533 if num < 1 {
534 return b[n:n], isNull, n, nil
535 }
536
537 n += int(num)
538
539 // Check data length
540 if len(b) >= n {
541 return b[n-int(num) : n : n], false, n, nil
542 }
543 return nil, false, n, io.EOF
544}
545
546// returns the number of bytes skipped and an error, in case the string is
547// longer than the input slice

Callers 3

readColumnsMethod · 0.85
readRowMethod · 0.85
readRowMethod · 0.85

Calls 1

readLengthEncodedIntegerFunction · 0.85

Tested by

no test coverage detected