Class ControlMessage (0.6.1)

public abstract class ControlMessage extends WireMessage

Generic representation for a control wire message: that is, a message which does not handle any form of start-up, but reather general communications.

Inheritance

java.lang.Object > WireMessage > ControlMessage

Static Methods

create(ConnectionHandler connection)

public static ControlMessage create(ConnectionHandler connection)

Factory method to create the message from the specific command type char.

Parameter
NameDescription
connectionConnectionHandler

The connection handler object setup with the ability to send/receive.

Returns
TypeDescription
ControlMessage

The constructed wire message given the input message.

Exceptions
TypeDescription
Exception

If construction or reading fails.

getFormatCodes(DataInputStream input)

protected static List<Short> getFormatCodes(DataInputStream input)

Extract format codes from message (useful for both input and output format codes).

Parameter
NameDescription
inputDataInputStream

The data stream containing the user request.

Returns
TypeDescription
List<Short>

A list of format codes.

Exceptions
TypeDescription
Exception

If reading fails in any way.

Constructors

ControlMessage(ConnectionHandler connection)

public ControlMessage(ConnectionHandler connection)
Parameter
NameDescription
connectionConnectionHandler

ControlMessage(ConnectionHandler connection, int length, ControlMessage.ManuallyCreatedToken token)

protected ControlMessage(ConnectionHandler connection, int length, ControlMessage.ManuallyCreatedToken token)

Constructor for manually created Control messages.

Parameters
NameDescription
connectionConnectionHandler
lengthint
tokenControlMessage.ManuallyCreatedToken

Methods

handleError(Exception exception)

protected void handleError(Exception exception)

Takes an Exception Object and relates its results to the user within the client.

Parameter
NameDescription
exceptionException

The exception to be related.

Exceptions
TypeDescription
Exception

if there is some issue in the sending of the error messages.

isExtendedProtocol()

protected boolean isExtendedProtocol()
Returns
TypeDescription
boolean

sendResultSet(IntermediateStatement describedResult, ConnectionHandler.QueryMode mode, long maxRows)

public SendResultSetState sendResultSet(IntermediateStatement describedResult, ConnectionHandler.QueryMode mode, long maxRows)

Simple Adapter, which takes specific results from Spanner, and packages them in a format Postgres understands.

Parameters
NameDescription
describedResultIntermediateStatement

Statement output by Spanner.

modeConnectionHandler.QueryMode

Specific Query Mode required for this specific message for Postgres

maxRowslong

Maximum number of rows requested

Returns
TypeDescription
SendResultSetState

An adapted representation with specific metadata which PG wire requires.

Exceptions
TypeDescription
Exception

if traversing the ResultSet fails.

sendSpannerResult(IntermediateStatement statement, ConnectionHandler.QueryMode mode, long maxRows)

public void sendSpannerResult(IntermediateStatement statement, ConnectionHandler.QueryMode mode, long maxRows)

Sends the result of an execute or query to the client. The type of message depends on the type of result of the statement. This method may also be called multiple times for one result if the client has set a max number of rows to fetch for each execute message. The IntermediateStatement will cache the result in between calls and continue serving rows from the position it was left off after the last execute message.

NOTE: This method does not flush the output stream.

Parameters
NameDescription
statementIntermediateStatement
modeConnectionHandler.QueryMode
maxRowslong
Exceptions
TypeDescription
Exception