File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -699,6 +699,23 @@ QString QgsPostgresConn::quotedValue( QVariant value )
699699
700700PGresult *QgsPostgresConn::PQexec ( QString query, bool logError )
701701{
702+ if ( PQstatus () != CONNECTION_OK )
703+ {
704+ if ( logError )
705+ {
706+ QgsMessageLog::logMessage ( tr ( " Connection error: %1 returned %2 [%3]" )
707+ .arg ( query ).arg ( PQstatus () ).arg ( PQerrorMessage () ),
708+ tr ( " PostGIS" ) );
709+ }
710+ else
711+ {
712+ QgsDebugMsg ( QString ( " Connection error: %1 returned %2 [%3]" )
713+ .arg ( query ).arg ( PQstatus () ).arg ( PQerrorMessage () ) );
714+ }
715+
716+ return 0 ;
717+ }
718+
702719 QgsDebugMsgLevel ( QString ( " Executing SQL: %1" ).arg ( query ), 3 );
703720 PGresult *res = ::PQexec ( mConn , query.toUtf8 () );
704721
You can’t perform that action at this time.
0 commit comments