MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / readLengthEncodedNumber

Function readLengthEncodedNumber

src/Core/MySQL/IMySQLReadPacket.cpp:48–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48uint64_t readLengthEncodedNumber(ReadBuffer & buffer, UInt16 & bytes_read)
49{
50 char c{};
51 uint64_t buf = 0;
52 buffer.readStrict(c);
53 bytes_read = 1;
54 auto cc = static_cast<uint8_t>(c);
55 switch (cc)
56 {
57 /// NULL
58 case 0xfb:
59 break;
60 case 0xfc:
61 buffer.readStrict(reinterpret_cast<char *>(&buf), 2);
62 bytes_read += 2;
63 break;
64 case 0xfd:
65 buffer.readStrict(reinterpret_cast<char *>(&buf), 3);
66 bytes_read += 3;
67 break;
68 case 0xfe:
69 buffer.readStrict(reinterpret_cast<char *>(&buf), 8);
70 bytes_read += 8;
71 break;
72 default:
73 return cc;
74 }
75 return buf;
76}
77
78uint64_t readLengthEncodedNumber(ReadBuffer & buffer)
79{

Callers 3

readLengthEncodedStringFunction · 0.85
readPayloadImplMethod · 0.85
readPayloadImplMethod · 0.85

Calls 1

readStrictMethod · 0.45

Tested by

no test coverage detected