Skip to content

Commit 68c015e

Browse files
committedNov 8, 2015
postgres provider: catch if commit fails (fixes #12462)
1 parent a181845 commit 68c015e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,8 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
19621962
}
19631963

19641964
conn->PQexecNR( "DEALLOCATE addfeatures" );
1965-
conn->commit();
1965+
1966+
returnvalue &= conn->commit();
19661967

19671968
mShared->addFeaturesCounted( flist.size() );
19681969
}
@@ -2010,7 +2011,7 @@ bool QgsPostgresProvider::deleteFeatures( const QgsFeatureIds & id )
20102011
mShared->removeFid( *it );
20112012
}
20122013

2013-
conn->commit();
2014+
returnvalue &= conn->commit();
20142015

20152016
if ( mSpatialColType == sctTopoGeometry )
20162017
{
@@ -2095,7 +2096,7 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
20952096
}
20962097
}
20972098

2098-
conn->commit();
2099+
returnvalue &= conn->commit();
20992100
}
21002101
catch ( PGException &e )
21012102
{
@@ -2150,7 +2151,7 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
21502151
mAttributeFields.remove( index );
21512152
}
21522153

2153-
conn->commit();
2154+
returnvalue &= conn->commit();
21542155
}
21552156
catch ( PGException &e )
21562157
{
@@ -2262,7 +2263,7 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &
22622263
}
22632264
}
22642265

2265-
conn->commit();
2266+
returnvalue &= conn->commit();
22662267
}
22672268
catch ( PGException &e )
22682269
{
@@ -2458,7 +2459,8 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
24582459
connectionRO()->PQexecNR( "DEALLOCATE getid" );
24592460
conn->PQexecNR( "DEALLOCATE replacetopogeom" );
24602461
}
2461-
conn->commit();
2462+
2463+
returnvalue &= conn->commit();
24622464
}
24632465
catch ( PGException &e )
24642466
{

0 commit comments

Comments
 (0)
Please sign in to comment.