MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / LengthEncodedString

Function LengthEncodedString

IceFireDB-SQLite/pkg/mysql/mysql/util.go:196–210  ·  view source on GitHub ↗

LengthEncodedString 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

194// the number of bytes read and an error, in case the string is longer than
195// the input slice
196func LengthEncodedString(b []byte) ([]byte, bool, int, error) {
197 // Get length
198 num, isNull, n := LengthEncodedInt(b)
199 if num < 1 {
200 return b[n:n], isNull, n, nil
201 }
202
203 n += int(num)
204
205 // Check data length
206 if len(b) >= n {
207 return b[n-int(num) : n : n], false, n, nil
208 }
209 return nil, false, n, io.EOF
210}
211
212func SkipLengthEncodedString(b []byte) (int, error) {
213 // Get length

Callers 5

ParseTextMethod · 0.70
ParseBinaryMethod · 0.70
ParseMethod · 0.70
readAuthDataMethod · 0.50
bindStmtArgsMethod · 0.50

Calls 1

LengthEncodedIntFunction · 0.70

Tested by

no test coverage detected