Skip to content

Commit

Permalink
Throw error messages using session
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Ramsey committed Jun 14, 2013
1 parent 1f21d25 commit 37140ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/pdal/drivers/pgpointcloud/common.hpp
Expand Up @@ -101,7 +101,7 @@ inline void pg_execute(PGconn* session, std::string const& sql)
PGresult *result = PQexec(session, sql.c_str());
if ( (!result) || (PQresultStatus(result) != PGRES_COMMAND_OK) )
{
throw pdal_error(PQresultErrorMessage(result));
throw pdal_error(PQerrorMessage(session));
}
PQclear(result);
}
Expand Down Expand Up @@ -138,10 +138,12 @@ inline char* pg_query_once(PGconn* session, std::string const& sql)
inline PGresult* pg_query_result(PGconn* session, std::string const& sql)
{
PGresult *result = PQexec(session, sql.c_str());
if ( ! result )
throw pdal_error(PQerrorMessage(session));

if ( PQresultStatus(result) != PGRES_TUPLES_OK )
{
throw pdal_error(PQresultErrorMessage(result));
}

return result;
}

Expand Down

0 comments on commit 37140ef

Please sign in to comment.