Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Improve handling of errors in the connection and query thread classes.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.pgadmin.org/trunk@6456 a7884b65-44f6-0310-8a51-81a127f17b15
  • Loading branch information
dpage committed Jul 18, 2007
1 parent 310c5ba commit defbaeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pgadmin/db/pgConn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,12 @@ void pgConn::SetLastResultError(PGresult *res)
lastResultError.source_line = wxString(PQresultErrorField(res, PG_DIAG_SOURCE_LINE), *conv);
lastResultError.source_function = wxString(PQresultErrorField(res, PG_DIAG_SOURCE_FUNCTION), *conv);

wxString errMsg = lastResultError.severity + wxT(": ") + lastResultError.msg_primary;
wxString errMsg;

if (lastResultError.severity != wxEmptyString && lastResultError.msg_primary != wxEmptyString)
errMsg = lastResultError.severity + wxT(": ") + lastResultError.msg_primary;
else if (lastResultError.msg_primary != wxEmptyString)
errMsg = lastResultError.msg_primary;

if (!lastResultError.sql_state.IsEmpty())
{
Expand Down
5 changes: 4 additions & 1 deletion pgadmin/db/pgQueryThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ int pgQueryThread::execute()
if (*s)
rowsInserted = atol(s);
}

else if (rc == PGRES_FATAL_ERROR)
{
appendMessage(conn->GetLastError() + wxT("\n"));
}
return(1);
}

Expand Down

0 comments on commit defbaeb

Please sign in to comment.