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

Function send_message

tests/python/test_row_description_debug.py:31–38  ·  view source on GitHub ↗

Send a PostgreSQL wire protocol message

(sock, msg_type, body)

Source from the content-addressed store, hash-verified

29 return msg_type, body
30
31def send_message(sock, msg_type, body):
32 """Send a PostgreSQL wire protocol message"""
33 if msg_type:
34 msg = msg_type.encode() + struct.pack('!I', len(body) + 4) + body
35 else:
36 # Startup message has no type byte
37 msg = struct.pack('!I', len(body) + 4) + body
38 sock.send(msg)
39
40def main():
41 # Start pgsqlite

Callers 1

mainFunction · 0.85

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected