commit da0e3ae02032328c792727806cca68be8e91118f
Author: Tom Hughes <tom@compton.nu>
Date: Fri Jul 14 13:20:38 2023 +0100
Make conversion of status enum to the underlying type explicit
diff --git a/src/pgsql.cpp b/src/pgsql.cpp
index 1cd908f2..611cf5f3 100644
--- a/src/pgsql.cpp
+++ b/src/pgsql.cpp
@@ -16,6 +16,7 @@
#include <cassert>
#include <stdexcept>
#include <string>
+#include <type_traits>
#include <utility>
std::atomic<std::uint32_t> pg_conn_t::connection_id{0};
@@ -169,7 +170,8 @@ pg_result_t pg_conn_t::exec_prepared_internal(char const *stmt, int num_params,
if (status != PGRES_COMMAND_OK && status != PGRES_TUPLES_OK) {
log_error("SQL command failed: EXECUTE {}({})", stmt,
concat_params(num_params, param_values));
- throw fmt_error("Database error: {} ({})", error_msg(), status);
+ throw fmt_error("Database error: {} ({})", error_msg(),
+ std::underlying_type_t<ExecStatusType>(status));
}
return res;