EOF Packet Wrapper. It uses an existing packet object, and wraps around it, exposing useful variables while still providing access to the original packet objects variables and methods.
| 312 | |
| 313 | |
| 314 | class EOFPacketWrapper: |
| 315 | """ |
| 316 | EOF Packet Wrapper. It uses an existing packet object, and wraps |
| 317 | around it, exposing useful variables while still providing access |
| 318 | to the original packet objects variables and methods. |
| 319 | """ |
| 320 | |
| 321 | def __init__(self, from_packet): |
| 322 | if not from_packet.is_eof_packet(): |
| 323 | raise ValueError( |
| 324 | f"Cannot create '{self.__class__}' object from invalid packet type" |
| 325 | ) |
| 326 | |
| 327 | self.packet = from_packet |
| 328 | self.warning_count, self.server_status = self.packet.read_struct("<xhh") |
| 329 | if DEBUG: |
| 330 | print("server_status=", self.server_status) |
| 331 | self.has_next = self.server_status & SERVER_STATUS.SERVER_MORE_RESULTS_EXISTS |
| 332 | |
| 333 | def __getattr__(self, key): |
| 334 | return getattr(self.packet, key) |
| 335 | |
| 336 | |
| 337 | class LoadLocalPacketWrapper: |
no outgoing calls
no test coverage detected
searching dependent graphs…