diff --git a/src/ogawayama/stub/transaction.cpp b/src/ogawayama/stub/transaction.cpp index db090a5..cc27166 100644 --- a/src/ogawayama/stub/transaction.cpp +++ b/src/ogawayama/stub/transaction.cpp @@ -195,15 +195,12 @@ ErrorCode Transaction::Impl::execute_statement(PreparedStatementPtr& prepared, c ::jogasaki::proto::sql::common::PreparedStatement prepaed_statement{}; prepaed_statement.set_handle(ps_impl->get_id()); prepaed_statement.set_has_result_records(ps_impl->has_result_records()); - request.set_allocated_prepared_statement_handle(&prepaed_statement); + *(request.mutable_prepared_statement_handle()) = prepaed_statement; for (auto& e : parameters) { *(request.add_parameters()) = std::visit(parameter(e.first), e.second); } auto response_opt = transport_.send(request); - request.clear_parameters(); - request.release_prepared_statement_handle(); - request.clear_transaction_handle(); if (!response_opt) { return ErrorCode::SERVER_FAILURE; @@ -274,16 +271,13 @@ ErrorCode Transaction::Impl::execute_query(PreparedStatementPtr& prepared, const ::jogasaki::proto::sql::common::PreparedStatement prepaed_statement{}; prepaed_statement.set_handle(ps_impl->get_id()); prepaed_statement.set_has_result_records(ps_impl->has_result_records()); - request.set_allocated_prepared_statement_handle(&prepaed_statement); + *(request.mutable_prepared_statement_handle()) = prepaed_statement; try { for (auto& e : parameters) { *(request.add_parameters()) = std::visit(parameter(e.first), e.second); } std::size_t query_index = get_query_index(); auto response_opt = transport_.send(request, query_index); - request.clear_parameters(); - request.release_prepared_statement_handle(); - request.clear_transaction_handle(); if (!response_opt) { return ErrorCode::SERVER_FAILURE; } diff --git a/src/ogawayama/transport/transport.h b/src/ogawayama/transport/transport.h index e7a3736..0ae6fda 100644 --- a/src/ogawayama/transport/transport.h +++ b/src/ogawayama/transport/transport.h @@ -422,21 +422,16 @@ class transport { tateyama::proto::endpoint::request::WireInformation wire_information{}; tateyama::proto::endpoint::request::WireInformation::IpcInformation ipc_information{}; ipc_information.set_connection_information(std::to_string(getpid())); - wire_information.set_allocated_ipc_information(&ipc_information); + *(wire_information.mutable_ipc_information()) = ipc_information; tateyama::proto::endpoint::request::Handshake handshake{}; - handshake.set_allocated_client_information(&information); - handshake.set_allocated_wire_information(&wire_information); - tateyama::proto::endpoint::request::Request request{}; - request.set_allocated_handshake(&handshake); - auto response = send(request); - (void)request.release_handshake(); + *(handshake.mutable_client_information()) = information; + *(handshake.mutable_wire_information()) = wire_information; - (void)wire_information.release_ipc_information(); - (void)handshake.release_wire_information(); + tateyama::proto::endpoint::request::Request request{}; + *(request.mutable_handshake()) = handshake; - (void)handshake.release_client_information(); - return response; + return send(request); } std::optional receive(tateyama::common::wire::message_header::index_type index) {