Search in sources :

Example 1 with ParameterStatusResponse

use of com.google.cloud.spanner.pgadapter.wireoutput.ParameterStatusResponse in project pgadapter by GoogleCloudPlatform.

the class BootstrapMessage method sendStartupMessage.

/**
 * Expected PG start-up reply, including Auth approval, Key Data connection-specific info,
 * PGAdapter specific parameters, and a ready signal.
 *
 * @param output The data output stream to send results to.
 * @param connectionId The connection Id representing the current connection to send to client.
 * @param secret The secret apposite this connection
 * @throws Exception
 */
public static void sendStartupMessage(DataOutputStream output, int connectionId, int secret, OptionsMetadata options) throws Exception {
    new AuthenticationOkResponse(output).send();
    new KeyDataResponse(output, connectionId, secret).send();
    new ParameterStatusResponse(output, "server_version".getBytes(), options.getServerVersion().getBytes()).send();
    new ParameterStatusResponse(output, "application_name".getBytes(), "PGAdapter".getBytes()).send();
    new ParameterStatusResponse(output, "is_superuser".getBytes(), "false".getBytes()).send();
    new ParameterStatusResponse(output, "session_authorization".getBytes(), "PGAdapter".getBytes()).send();
    new ParameterStatusResponse(output, "integer_datetimes".getBytes(), "on".getBytes()).send();
    new ParameterStatusResponse(output, "server_encoding".getBytes(), "UTF8".getBytes()).send();
    new ParameterStatusResponse(output, "client_encoding".getBytes(), "UTF8".getBytes()).send();
    new ParameterStatusResponse(output, "DateStyle".getBytes(), "ISO,YMD".getBytes()).send();
    new ParameterStatusResponse(output, "IntervalStyle".getBytes(), "iso_8601".getBytes()).send();
    new ParameterStatusResponse(output, "standard_conforming_strings".getBytes(), "on".getBytes()).send();
    new ParameterStatusResponse(output, "TimeZone".getBytes(), TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT).getBytes()).send();
    new ReadyResponse(output, Status.IDLE).send();
}
Also used : ReadyResponse(com.google.cloud.spanner.pgadapter.wireoutput.ReadyResponse) AuthenticationOkResponse(com.google.cloud.spanner.pgadapter.wireoutput.AuthenticationOkResponse) ParameterStatusResponse(com.google.cloud.spanner.pgadapter.wireoutput.ParameterStatusResponse) KeyDataResponse(com.google.cloud.spanner.pgadapter.wireoutput.KeyDataResponse)

Aggregations

AuthenticationOkResponse (com.google.cloud.spanner.pgadapter.wireoutput.AuthenticationOkResponse)1 KeyDataResponse (com.google.cloud.spanner.pgadapter.wireoutput.KeyDataResponse)1 ParameterStatusResponse (com.google.cloud.spanner.pgadapter.wireoutput.ParameterStatusResponse)1 ReadyResponse (com.google.cloud.spanner.pgadapter.wireoutput.ReadyResponse)1