Skip to content
Permalink
Browse files

postgres provider: remove attribute in reverse order (fixes #8142)

  • Loading branch information
jef-n committed Jun 29, 2013
1 parent ee17616 commit 4a37805a80392e2ec5c99ab7e1082ada7ff7c8cf
@@ -462,27 +462,22 @@ void QgsVectorLayerEditBuffer::rollBack()
Q_ASSERT( mAddedFeatures.isEmpty() );
}





/*QString QgsVectorLayerEditBuffer::dumpEditBuffer()
#if 0
QString QgsVectorLayerEditBuffer::dumpEditBuffer()
{
QString msg;
if (!mChangedGeometries.isEmpty())
if ( !mChangedGeometries.isEmpty() )
{
msg += "CHANGED GEOMETRIES:\n";
for (QgsGeometryMap::const_iterator it = mChangedGeometries.begin(); it != mChangedGeometries.end(); ++it)
for ( QgsGeometryMap::const_iterator it = mChangedGeometries.begin(); it != mChangedGeometries.end(); ++it )
{
// QgsFeatureId, QgsGeometry
msg += QString("- FID %1: %2").arg(it.key()).arg(it.value().to)
msg += QString( "- FID %1: %2" ).arg( it.key() ).arg( it.value().to );
}
}
return msg;
}*/



}
#endif

void QgsVectorLayerEditBuffer::handleAttributeAdded( int index )
{
@@ -1509,11 +1509,6 @@ bool QgsOracleProvider::addAttributes( const QList<QgsField> &attributes )
return returnvalue;
}

static int moreThan( int a, int b )
{
return a > b;
}

bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds& ids )
{
bool returnvalue = true;
@@ -1535,7 +1530,8 @@ bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds& ids )
qry.finish();

QList<int> idsList = ids.values();
qSort( idsList.begin(), idsList.end(), moreThan );
qSort( idsList.begin(), idsList.end(), qGreater<int>() );

foreach ( int id, idsList )
{
const QgsField &fld = mAttributeFields.at( id );
@@ -1926,7 +1926,10 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
{
mConnectionRW->PQexecNR( "BEGIN" );

for ( QgsAttributeIds::const_iterator iter = ids.begin(); iter != ids.end(); ++iter )
QList<int> idsList = ids.values();
qSort( idsList.begin(), idsList.end(), qGreater<int>() );

for ( QList<int>::const_iterator iter = idsList.begin(); iter != idsList.end(); ++iter )
{
int index = *iter;
if ( index < 0 || index >= mAttributeFields.count() )

0 comments on commit 4a37805

Please sign in to comment.
You can’t perform that action at this time.