src/main/java/software/amazon/qldb/Session.java
ExecuteStatementResult sendExecute(String statement, List<IonValue> parameters, String txnId) {
        final List<ValueHolder> byteParameters = new ArrayList<>(parameters.size());

        if (!parameters.isEmpty()) {
            try {
                final IonBinaryWriterBuilder builder = IonBinaryWriterBuilder.standard();
                final ByteArrayOutputStream stream = new ByteArrayOutputStream();
                final IonWriter writer = builder.build(stream);
                for (IonValue parameter : parameters) {
                    parameter.writeTo(writer);
                    writer.finish();
                    final SdkBytes sdkBytes = SdkBytes.fromByteArray(stream.toByteArray());
                    final ValueHolder value = ValueHolder.builder().ionBinary(sdkBytes).build();
                    byteParameters.add(value);

                    // Reset the stream so that it can be re-used.
                    stream.reset();
                }
            } catch (IOException e) {
                throw QldbDriverException.create(String.format(Errors.SERIALIZING_PARAMS.get(), e.getMessage()),
                                                 e);
            }
        }

        final ExecuteStatementRequest request = ExecuteStatementRequest.builder()
                                                                       .statement(statement)
                                                                       .parameters(byteParameters)
                                                                       .transactionId(txnId)
                                                                       .build();
        SendCommandResponse result = send(SendCommandRequest.builder().executeStatement(request));
        return result.executeStatement();
    }
/**
     * Send an execute request with parameters to QLDB.
     *
     * @param statement
     *              The PartiQL statement to execute.
     * @param parameters
     *              The parameters to use with the PartiQL statement for execution.
     * @param txnId
     *              The unique ID of the transaction to execute.
     *
     * @return The result of the execution, which contains a {@link Page} representing the first data chunk.
     */
Send an execute request with parameters to QLDB.
@param statement
The PartiQL statement to execute.
@param parameters
The parameters to use with the PartiQL statement for execution.
@param txnId
The unique ID of the transaction to execute.

@return The result of the execution, which contains a  Page representing the first data chunk.
Send an execute request with parameters to QLDB . @param statement The PartiQL statement to execute . @param parameters The parameters to use with the PartiQL statement for execution . @param txnId The unique ID of the transaction to execute . @return The result of the execution which contains a Page representing the first data chunk .
ExecuteStatementResult sendExecute(String statement, List<IonValue> parameters, String txnId) {
        final List<ValueHolder> byteParameters = new ArrayList<>(parameters.size());
        if (!parameters.isEmpty()) {
            try {
                final IonBinaryWriterBuilder builder = IonBinaryWriterBuilder.standard();
                final ByteArrayOutputStream stream = new ByteArrayOutputStream();
                final IonWriter writer = builder.build(stream);
                for (IonValue parameter : parameters) {
                    parameter.writeTo(writer);
                    writer.finish();
                    final SdkBytes sdkBytes = SdkBytes.fromByteArray(stream.toByteArray());
                    final ValueHolder value = ValueHolder.builder().ionBinary(sdkBytes).build();
                    byteParameters.add(value);
                    stream.reset();
                }
            } catch (IOException e) {
                throw QldbDriverException.create(String.format(Errors.SERIALIZING_PARAMS.get(), e.getMessage()),
                                                 e);
            }
        }
        final ExecuteStatementRequest request = ExecuteStatementRequest.builder()
                                                                       .statement(statement)
                                                                       .parameters(byteParameters)
                                                                       .transactionId(txnId)
                                                                       .build();
        SendCommandResponse result = send(SendCommandRequest.builder().executeStatement(request));
        return result.executeStatement();
    }
ExecuteStatementResult sendExecute ( String statement , List < IonValue > parameters , String txnId ) { final List < ValueHolder > byteParameters = new ArrayList < > ( parameters . size ( ) ) ; if ( ! parameters . isEmpty ( ) ) { try { final IonBinaryWriterBuilder builder = IonBinaryWriterBuilder . standard ( ) ; final ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; final IonWriter writer = builder . build ( stream ) ; for ( IonValue parameter : parameters ) { parameter . writeTo ( writer ) ; writer . finish ( ) ; final SdkBytes sdkBytes = SdkBytes . fromByteArray ( stream . toByteArray ( ) ) ; final ValueHolder value = ValueHolder . builder ( ) . ionBinary ( sdkBytes ) . build ( ) ; byteParameters . add ( value ) ; stream . reset ( ) ; } } catch ( IOException e ) { throw QldbDriverException . create ( String . format ( Errors . SERIALIZING_PARAMS . get ( ) , e . getMessage ( ) ) , e ) ; } } final ExecuteStatementRequest request = ExecuteStatementRequest . builder ( ) . statement ( statement ) . parameters ( byteParameters ) . transactionId ( txnId ) . build ( ) ; SendCommandResponse result = send ( SendCommandRequest . builder ( ) . executeStatement ( request ) ) ; return result . executeStatement ( ) ; }
Send an execute request with parameters to QLDB.
Send an execute request with parameters to QLDB .
// Reset the stream so that it can be re-used.