Class PgClientMessage.

Inherits Garbage. Inherited by PgBind, PgCancel, PgCopyData, PgCopyDone, PgCopyFail, PgDescribe, PgExecute, PgFlush, PgParse, PgPasswordMessage, PgQuery, PgStartup, PgSync and PgTerminate.

An abstract base class for PostgreSQL frontend messages.

We treat client messages like server messages, dedicating a subclass to each message type. The subclass is expected to provide accessors to set the message fields, and an encodeData function that uses the appendByte/appendInt32 and other functions to assemble the encoded message. The base class prepends the message type and length.

The message is sent by enqueue()ing it to a write buffer.

PgClientMessage::PgClientMessage( char t )

Creates a new PgClientMessage of type t.

void PgClientMessage::appendByte( char c )

Appends a single byte c to the message data.

void PgClientMessage::appendByten( const EString & s )

Appends the bytes from s to the message data.

void PgClientMessage::appendInt16( int16 n )

Appends n to the message data as a 16-bit integer in network byte order.

void PgClientMessage::appendInt32( int n )

Appends n to the message data as a 32-bit integer in network byte order.

void PgClientMessage::appendString( const EString & s )

Appends s to the message data as a NUL-terminated string.

void PgClientMessage::encodeData()

Every PgClientMessage subclass must implement this function, which is used by enqueue() to encode the type-specific part of messages.

void PgClientMessage::enqueue( Buffer * buf )

Assembles a message, and appends the resulting packet (type, length, data) to buf. It relies on subclasses to "encodeData()" properly.


This virtual destructor exists only for safe subclassing.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.