Skip to content
Permalink
Browse files

oracle provider: reload fields after adding or deleting attributes (f…

…ixes #10102)
  • Loading branch information
jef-n committed Jun 20, 2014
1 parent 427381e commit 9414717b03dfff05e70a3d9cd64c53df57cb7d9e
Showing with 13 additions and 2 deletions.
  1. +1 −1 src/core/qgsvectorlayereditbuffer.cpp
  2. +12 −1 src/providers/oracle/qgsoracleprovider.cpp
@@ -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];
@@ -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() );
@@ -1489,6 +1489,7 @@ bool QgsOracleProvider::addAttributes( const QList<QgsField> &attributes )
}

qry.finish();

}

if ( !db.commit() )
@@ -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;
}

@@ -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;
}

0 comments on commit 9414717

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