Skip to content

Commit

Permalink
postgres provider: fix error handling
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13375 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 24, 2010
1 parent 5f4b825 commit 509d247
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -3228,25 +3228,26 @@ bool QgsPostgresProvider::Conn::PQexecNR( QString query )
return false;
}

if ( PQresultStatus( res ) == PGRES_COMMAND_OK )
ExecStatusType errorStatus = PQresultStatus( res );
if ( errorStatus == PGRES_COMMAND_OK )
return true;

#ifdef QGISDEBUG
QString err = QString( "Query: %1 returned %2 [%3]" )
.arg( query )
.arg( errorStatus )
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) );
.arg( query )
.arg( errorStatus )
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) );
QgsDebugMsg( err );
#endif
if ( openCursors )
{
QgsPostgresProvider::showMessageBox(
tr( "Query failed" ),
tr( "%1 cursor states lost.\nSQL: %2\nResult: %3 (%4)" )
.arg( openCursors )
.arg( query )
.arg( errorStatus )
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) ) );
tr( "Query failed" ),
tr( "%1 cursor states lost.\nSQL: %2\nResult: %3 (%4)" )
.arg( openCursors )
.arg( query )
.arg( errorStatus )
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) ) );
openCursors = 0;
}

Expand Down

0 comments on commit 509d247

Please sign in to comment.