MCPcopy Create free account
hub / github.com/erans/pgsqlite / read_message

Function read_message

tests/python/test_protocol_trace.py:13–20  ·  view source on GitHub ↗

Read a backend message

(sock)

Source from the content-addressed store, hash-verified

11 sock.send(msg)
12
13def read_message(sock):
14 """Read a backend message"""
15 msg_type = sock.recv(1)
16 if not msg_type:
17 return None, None
18 msg_len = struct.unpack('>I', sock.recv(4))[0]
19 msg_data = sock.recv(msg_len - 4) if msg_len > 4 else b''
20 return msg_type, msg_data
21
22def send_query(sock, query):
23 """Send simple query"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected