Skip to content

Commit 4a37805

Browse files
committed
postgres provider: remove attribute in reverse order (fixes #8142)
1 parent ee17616 commit 4a37805

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

src/core/qgsvectorlayereditbuffer.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -462,27 +462,22 @@ void QgsVectorLayerEditBuffer::rollBack()
462462
Q_ASSERT( mAddedFeatures.isEmpty() );
463463
}
464464

465-
466-
467-
468-
469-
/*QString QgsVectorLayerEditBuffer::dumpEditBuffer()
465+
#if 0
466+
QString QgsVectorLayerEditBuffer::dumpEditBuffer()
470467
{
471468
QString msg;
472-
if (!mChangedGeometries.isEmpty())
469+
if ( !mChangedGeometries.isEmpty() )
473470
{
474471
msg += "CHANGED GEOMETRIES:\n";
475-
for (QgsGeometryMap::const_iterator it = mChangedGeometries.begin(); it != mChangedGeometries.end(); ++it)
472+
for ( QgsGeometryMap::const_iterator it = mChangedGeometries.begin(); it != mChangedGeometries.end(); ++it )
476473
{
477474
// QgsFeatureId, QgsGeometry
478-
msg += QString("- FID %1: %2").arg(it.key()).arg(it.value().to)
475+
msg += QString( "- FID %1: %2" ).arg( it.key() ).arg( it.value().to );
479476
}
480477
}
481478
return msg;
482-
}*/
483-
484-
485-
479+
}
480+
#endif
486481

487482
void QgsVectorLayerEditBuffer::handleAttributeAdded( int index )
488483
{

src/providers/oracle/qgsoracleprovider.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,11 +1509,6 @@ bool QgsOracleProvider::addAttributes( const QList<QgsField> &attributes )
15091509
return returnvalue;
15101510
}
15111511

1512-
static int moreThan( int a, int b )
1513-
{
1514-
return a > b;
1515-
}
1516-
15171512
bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds& ids )
15181513
{
15191514
bool returnvalue = true;
@@ -1535,7 +1530,8 @@ bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds& ids )
15351530
qry.finish();
15361531

15371532
QList<int> idsList = ids.values();
1538-
qSort( idsList.begin(), idsList.end(), moreThan );
1533+
qSort( idsList.begin(), idsList.end(), qGreater<int>() );
1534+
15391535
foreach ( int id, idsList )
15401536
{
15411537
const QgsField &fld = mAttributeFields.at( id );

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,10 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
19261926
{
19271927
mConnectionRW->PQexecNR( "BEGIN" );
19281928

1929-
for ( QgsAttributeIds::const_iterator iter = ids.begin(); iter != ids.end(); ++iter )
1929+
QList<int> idsList = ids.values();
1930+
qSort( idsList.begin(), idsList.end(), qGreater<int>() );
1931+
1932+
for ( QList<int>::const_iterator iter = idsList.begin(); iter != idsList.end(); ++iter )
19301933
{
19311934
int index = *iter;
19321935
if ( index < 0 || index >= mAttributeFields.count() )

0 commit comments

Comments
 (0)