MCPcopy
hub / github.com/PyMySQL/PyMySQL / read_length_encoded_integer

Method read_length_encoded_integer

pymysql/protocol.py:145–161  ·  view source on GitHub ↗

Read a 'Length Coded Binary' number from the data buffer. Length coded numbers can be anywhere from 1 to 9 bytes depending on the value of the first byte.

(self)

Source from the content-addressed store, hash-verified

143 return result
144
145 def read_length_encoded_integer(self):
146 """Read a 'Length Coded Binary' number from the data buffer.
147
148 Length coded numbers can be anywhere from 1 to 9 bytes depending
149 on the value of the first byte.
150 """
151 c = self.read_uint8()
152 if c == NULL_COLUMN:
153 return None
154 if c < UNSIGNED_CHAR_COLUMN:
155 return c
156 elif c == UNSIGNED_SHORT_COLUMN:
157 return self.read_uint16()
158 elif c == UNSIGNED_INT24_COLUMN:
159 return self.read_uint24()
160 elif c == UNSIGNED_INT64_COLUMN:
161 return self.read_uint64()
162
163 def read_length_coded_string(self):
164 """Read a 'Length Coded String' from the data buffer.

Callers 4

init_unbuffered_queryMethod · 0.80
_read_result_packetMethod · 0.80
__init__Method · 0.80

Calls 4

read_uint8Method · 0.95
read_uint16Method · 0.95
read_uint24Method · 0.95
read_uint64Method · 0.95

Tested by

no test coverage detected