@@ -136,12 +136,12 @@ pg_result_t pg_conn_t::exec(std::string const &sql) const
136136 return exec (sql.c_str ());
137137}
138138
139- void pg_conn_t::copy_start (std::string_view sql) const
139+ void pg_conn_t::copy_start (std::string const & sql) const
140140{
141141 assert (m_conn);
142142
143143 log_sql (" (C{}) {}" , m_connection_id, sql);
144- pg_result_t const res{PQexec (m_conn.get (), sql.data ())};
144+ pg_result_t const res{PQexec (m_conn.get (), sql.c_str ())};
145145 if (res.status () != PGRES_COPY_IN) {
146146 throw fmt_error (" Database error on COPY: {}" , error_msg ());
147147 }
@@ -194,15 +194,15 @@ void pg_conn_t::copy_end(std::string_view context) const
194194 }
195195}
196196
197- void pg_conn_t::prepare_internal (std::string_view stmt,
198- std::string_view sql) const
197+ void pg_conn_t::prepare_internal (std::string const & stmt,
198+ std::string const & sql) const
199199{
200200 if (get_logger ().log_sql ()) {
201201 log_sql (" (C{}) PREPARE {} AS {}" , m_connection_id, stmt, sql);
202202 }
203203
204204 pg_result_t const res{
205- PQprepare (m_conn.get (), stmt.data (), sql.data (), 0 , nullptr )};
205+ PQprepare (m_conn.get (), stmt.c_str (), sql.c_str (), 0 , nullptr )};
206206 if (res.status () != PGRES_COMMAND_OK) {
207207 throw fmt_error (" Prepare failed for '{}': {}." , sql, error_msg ());
208208 }
0 commit comments