[QGIS Commit] r13375 - trunk/qgis/src/providers/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Apr 24 16:59:47 EDT 2010


Author: jef
Date: 2010-04-24 16:59:46 -0400 (Sat, 24 Apr 2010)
New Revision: 13375

Modified:
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
Log:
postgres provider: fix error handling

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2010-04-24 20:06:45 UTC (rev 13374)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2010-04-24 20:59:46 UTC (rev 13375)
@@ -3228,25 +3228,26 @@
     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;
   }
 



More information about the QGIS-commit mailing list