Skip to content

Commit 509d247

Browse files
author
jef
committedApr 24, 2010
postgres provider: fix error handling
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13375 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,25 +3228,26 @@ bool QgsPostgresProvider::Conn::PQexecNR( QString query )
32283228
return false;
32293229
}
32303230

3231-
if ( PQresultStatus( res ) == PGRES_COMMAND_OK )
3231+
ExecStatusType errorStatus = PQresultStatus( res );
3232+
if ( errorStatus == PGRES_COMMAND_OK )
32323233
return true;
32333234

32343235
#ifdef QGISDEBUG
32353236
QString err = QString( "Query: %1 returned %2 [%3]" )
3236-
.arg( query )
3237-
.arg( errorStatus )
3238-
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) );
3237+
.arg( query )
3238+
.arg( errorStatus )
3239+
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) );
32393240
QgsDebugMsg( err );
32403241
#endif
32413242
if ( openCursors )
32423243
{
32433244
QgsPostgresProvider::showMessageBox(
3244-
tr( "Query failed" ),
3245-
tr( "%1 cursor states lost.\nSQL: %2\nResult: %3 (%4)" )
3246-
.arg( openCursors )
3247-
.arg( query )
3248-
.arg( errorStatus )
3249-
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) ) );
3245+
tr( "Query failed" ),
3246+
tr( "%1 cursor states lost.\nSQL: %2\nResult: %3 (%4)" )
3247+
.arg( openCursors )
3248+
.arg( query )
3249+
.arg( errorStatus )
3250+
.arg( QString::fromUtf8( PQresultErrorMessage( res ) ) ) );
32503251
openCursors = 0;
32513252
}
32523253

0 commit comments

Comments
 (0)
Please sign in to comment.