diff --git a/src/lib/pq/connection.cpp b/src/lib/pq/connection.cpp index b8cfae5..68d8ae1 100644 --- a/src/lib/pq/connection.cpp +++ b/src/lib/pq/connection.cpp @@ -537,7 +537,7 @@ namespace tao::pq throw pq::connection_error( error_message() ); // LCOV_EXCL_LINE } - auto result = connection::get_result( end ); + const auto result = connection::get_result( end ); switch( PQresultStatus( result.get() ) ) { case PGRES_COMMAND_OK: connection::clear_results( end ); diff --git a/src/lib/pq/transaction.cpp b/src/lib/pq/transaction.cpp index ed68d5e..bea2997 100644 --- a/src/lib/pq/transaction.cpp +++ b/src/lib/pq/transaction.cpp @@ -190,9 +190,8 @@ namespace tao::pq default:; } - if( const auto next = m_connection->get_result( end ) ) { - const auto status = PQresultStatus( next.get() ); - throw std::runtime_error( std::format( "unexpected result status: {}", PQresStatus( status ) ) ); + while( auto next = m_connection->get_result( end ) ) { + result = std::move( next ); } return pq::result( result.release() ); @@ -203,7 +202,7 @@ namespace tao::pq check_current_transaction(); const auto end = m_connection->timeout_end( start ); - auto result = m_connection->get_result( end ); + const auto result = m_connection->get_result( end ); if( !result ) { throw std::runtime_error( "unable to obtain result" ); }