@@ -43,7 +43,7 @@ pg_result_t pg_conn_t::query(ExecStatusType expect, char const *sql) const
4343
4444 log_sql (" {}" , sql);
4545 pg_result_t res{PQexec (m_conn.get (), sql)};
46- if (PQresultStatus ( res.get () ) != expect) {
46+ if (res.status ( ) != expect) {
4747 throw std::runtime_error{" Database error: {}" _format (error_msg ())};
4848 }
4949 return res;
@@ -121,7 +121,7 @@ void pg_conn_t::end_copy(std::string const &context) const
121121 }
122122
123123 pg_result_t const res{PQgetResult (m_conn.get ())};
124- if (PQresultStatus ( res.get () ) != PGRES_COMMAND_OK) {
124+ if (res.status ( ) != PGRES_COMMAND_OK) {
125125 throw std::runtime_error{fmt::format (
126126 " Ending COPY mode for '{}' failed: {}." , context, error_msg ())};
127127 }
@@ -156,11 +156,11 @@ pg_conn_t::exec_prepared_internal(char const *stmt, int num_params,
156156 }
157157 pg_result_t res{PQexecPrepared (m_conn.get (), stmt, num_params, param_values,
158158 nullptr , nullptr , 0 )};
159- if (PQresultStatus ( res.get () ) != PGRES_TUPLES_OK) {
159+ if (res.status ( ) != PGRES_TUPLES_OK) {
160160 log_error (" SQL command failed: EXECUTE {}({})" , stmt,
161161 concat_params (num_params, param_values));
162- throw std::runtime_error{" Database error: {} ({}) " _format (
163- error_msg (), PQresultStatus ( res.get () ))};
162+ throw std::runtime_error{
163+ " Database error: {} ({}) " _format ( error_msg (), res.status ( ))};
164164 }
165165
166166 return res;
0 commit comments