Skip to content
Permalink
Browse files

postgres provider: fix error handling

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13375 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Apr 24, 2010
1 parent 5f4b825 commit 509d247fe3028ff5eba7426b0ef9ef5a57df140e
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/providers/postgres/qgspostgresprovider.cpp
@@ -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;
}

0 comments on commit 509d247

Please sign in to comment.
You can’t perform that action at this time.