Skip to content

Commit

Permalink
postgres provider: catch if commit fails (fixes #12462)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Nov 8, 2015
1 parent a181845 commit 68c015e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1962,7 +1962,8 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
}

conn->PQexecNR( "DEALLOCATE addfeatures" );
conn->commit();

returnvalue &= conn->commit();

mShared->addFeaturesCounted( flist.size() );
}
Expand Down Expand Up @@ -2010,7 +2011,7 @@ bool QgsPostgresProvider::deleteFeatures( const QgsFeatureIds & id )
mShared->removeFid( *it );
}

conn->commit();
returnvalue &= conn->commit();

if ( mSpatialColType == sctTopoGeometry )
{
Expand Down Expand Up @@ -2095,7 +2096,7 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
}
}

conn->commit();
returnvalue &= conn->commit();
}
catch ( PGException &e )
{
Expand Down Expand Up @@ -2150,7 +2151,7 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
mAttributeFields.remove( index );
}

conn->commit();
returnvalue &= conn->commit();
}
catch ( PGException &e )
{
Expand Down Expand Up @@ -2262,7 +2263,7 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &
}
}

conn->commit();
returnvalue &= conn->commit();
}
catch ( PGException &e )
{
Expand Down Expand Up @@ -2458,7 +2459,8 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
connectionRO()->PQexecNR( "DEALLOCATE getid" );
conn->PQexecNR( "DEALLOCATE replacetopogeom" );
}
conn->commit();

returnvalue &= conn->commit();
}
catch ( PGException &e )
{
Expand Down

0 comments on commit 68c015e

Please sign in to comment.