File tree 2 files changed +10
-2
lines changed 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,8 @@ namespace tao::pq
150
150
return transaction_status () == transaction_status::idle;
151
151
}
152
152
153
+ [[nodiscard]] auto is_busy () const noexcept -> bool;
154
+
153
155
[[nodiscard]] auto direct () -> std::shared_ptr< pq::transaction >;
154
156
155
157
[[nodiscard]] auto transaction () -> std::shared_ptr< pq::transaction >;
Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ namespace tao::pq
277
277
auto connection::get_result ( const std::chrono::steady_clock::time_point end ) -> std::unique_ptr< PGresult, decltype( &PQclear ) >
278
278
{
279
279
bool wait_for_write = true ;
280
- while ( PQisBusy ( m_pgconn. get () ) != 0 ) {
280
+ while ( is_busy () ) {
281
281
if ( wait_for_write ) {
282
282
switch ( PQflush ( m_pgconn.get () ) ) {
283
283
case 0 :
@@ -289,7 +289,8 @@ namespace tao::pq
289
289
break ;
290
290
291
291
default :
292
- throw std::runtime_error ( std::format ( " PQflush() failed: {}" , error_message () ) ); // LCOV_EXCL_STOP
292
+ throw std::runtime_error ( std::format ( " PQflush() failed: {}" , error_message () ) );
293
+ // LCOV_EXCL_STOP
293
294
}
294
295
}
295
296
connection::wait ( wait_for_write, end );
@@ -502,6 +503,11 @@ namespace tao::pq
502
503
}
503
504
}
504
505
506
+ auto connection::is_busy () const noexcept -> bool
507
+ {
508
+ return PQisBusy ( m_pgconn.get () ) != 0 ;
509
+ }
510
+
505
511
auto connection::direct () -> std::shared_ptr< pq::transaction >
506
512
{
507
513
return std::make_shared< internal::autocommit_transaction >( shared_from_this () );
You can’t perform that action at this time.
0 commit comments