Search in sources :

Example 1 with ParameterDescriptionResponse

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

the class DescribeMessage method handleDescribeStatement.

/**
 * Called when a describe message of type 'S' is received.
 *
 * @throws Exception if sending the message back to the client causes an error.
 */
public void handleDescribeStatement() throws Exception {
    try {
        DescribeStatementMetadata metadata = (DescribeStatementMetadata) this.statement.describe();
        new ParameterDescriptionResponse(this.outputStream, metadata.getParameters()).send();
        if (metadata.getResultSet() != null) {
            new RowDescriptionResponse(this.outputStream, this.statement, metadata.getResultSet(), this.connection.getServer().getOptions(), QueryMode.EXTENDED).send();
        } else {
            new NoDataResponse(this.outputStream).send();
        }
    } catch (SpannerException exception) {
        this.handleError(exception);
    }
}
Also used : RowDescriptionResponse(com.google.cloud.spanner.pgadapter.wireoutput.RowDescriptionResponse) ParameterDescriptionResponse(com.google.cloud.spanner.pgadapter.wireoutput.ParameterDescriptionResponse) SpannerException(com.google.cloud.spanner.SpannerException) NoDataResponse(com.google.cloud.spanner.pgadapter.wireoutput.NoDataResponse) DescribeStatementMetadata(com.google.cloud.spanner.pgadapter.metadata.DescribeStatementMetadata)

Aggregations

SpannerException (com.google.cloud.spanner.SpannerException)1 DescribeStatementMetadata (com.google.cloud.spanner.pgadapter.metadata.DescribeStatementMetadata)1 NoDataResponse (com.google.cloud.spanner.pgadapter.wireoutput.NoDataResponse)1 ParameterDescriptionResponse (com.google.cloud.spanner.pgadapter.wireoutput.ParameterDescriptionResponse)1 RowDescriptionResponse (com.google.cloud.spanner.pgadapter.wireoutput.RowDescriptionResponse)1