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.
| 305 | |
| 306 | |
| 307 | class EOFPacketWrapper: |
| 308 | """ |
| 309 | EOF Packet Wrapper. It uses an existing packet object, and wraps |
| 310 | around it, exposing useful variables while still providing access |
| 311 | to the original packet objects variables and methods. |
| 312 | """ |
| 313 | |
| 314 | def __init__(self, from_packet): |
| 315 | if not from_packet.is_eof_packet(): |
| 316 | raise ValueError( |
| 317 | f"Cannot create '{self.__class__}' object from invalid packet type" |
| 318 | ) |
| 319 | |
| 320 | self.packet = from_packet |
| 321 | self.warning_count, self.server_status = self.packet.read_struct("<xhh") |
| 322 | if DEBUG: |
| 323 | print("server_status=", self.server_status) |
| 324 | self.has_next = self.server_status & SERVER_STATUS.SERVER_MORE_RESULTS_EXISTS |
| 325 | |
| 326 | def __getattr__(self, key): |
| 327 | return getattr(self.packet, key) |
| 328 | |
| 329 | |
| 330 | class LoadLocalPacketWrapper: |
no outgoing calls
no test coverage detected