MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / read_length_encoded_integer

Method read_length_encoded_integer

pymysql/protocol.py:144–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

142 return result
143
144 def read_length_encoded_integer(self):
145 """Read a 'Length Coded Binary' number from the data buffer.
146
147 Length coded numbers can be anywhere from 1 to 9 bytes depending
148 on the value of the first byte.
149 """
150 c = self._data[self._position]
151 self._position += 1
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 3

read_uint16Method · 0.95
read_uint24Method · 0.95
read_uint64Method · 0.95

Tested by

no test coverage detected