Skip to content

Commit

Permalink
oracle provider: reload fields after adding or deleting attributes (f…
Browse files Browse the repository at this point in the history
…ixes #10102)
  • Loading branch information
jef-n committed Jun 20, 2014
1 parent 427381e commit 9414717
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayereditbuffer.cpp
Expand Up @@ -319,7 +319,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
attributeChangesOk = false; // don't try attribute updates - they'll fail.
}

for ( int i = 0; i < oldFields.count(); ++i )
for ( int i = 0; i < qMin( oldFields.count(), newFields.count() ); ++i )
{
const QgsField& oldField = oldFields[i];
const QgsField& newField = newFields[i];
Expand Down
13 changes: 12 additions & 1 deletion src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -1452,7 +1452,7 @@ bool QgsOracleProvider::addAttributes( const QList<QgsField> &attributes )

for ( QList<QgsField>::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter )
{
QString type = iter->typeName();
QString type = iter->typeName().toLower();
if ( type == "char" || type == "varchar2" )
{
type = QString( "%1(%2 char)" ).arg( type ).arg( iter->length() );
Expand Down Expand Up @@ -1489,6 +1489,7 @@ bool QgsOracleProvider::addAttributes( const QList<QgsField> &attributes )
}

qry.finish();

}

if ( !db.commit() )
Expand All @@ -1504,6 +1505,11 @@ bool QgsOracleProvider::addAttributes( const QList<QgsField> &attributes )
returnvalue = false;
}

if( !loadFields() )
{
QgsMessageLog::logMessage( tr( "Could not reload fields." ), tr( "Oracle" ) );
}

return returnvalue;
}

Expand Down Expand Up @@ -1562,6 +1568,11 @@ bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds& ids )
returnvalue = false;
}

if( !loadFields() )
{
QgsMessageLog::logMessage( tr( "Could not reload fields." ), tr( "Oracle" ) );
}

return returnvalue;
}

Expand Down

0 comments on commit 9414717

Please sign in to comment.