Skip to content
Permalink
Browse files
WFS-T debugging and using provider for adding features
  • Loading branch information
rldhont committed Nov 30, 2012
1 parent 727d66a commit 5b4118725b1ac36169e34511601e41a4da730900
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/mapserver/qgswfsserver.cpp
@@ -1168,6 +1168,9 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
typeName = actionElem.attribute( "typeName" );
}

if ( typeName.contains( ":" ) )
typeName = typeName.section( ":", 1, 1 );

QDomNodeList typeNameList = mDocElem.elementsByTagName( typeName );
if ( typeNameList.count() == 0 )
{
@@ -1424,13 +1427,12 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
}
// Add the feature to th layer
// and store it to put it's Feature Id in the response
layer->addFeature( *f, true );
inFeatList << *f;
inFeatList.append( *f );
}
}
}
// Commit the changes of the insert elements
if ( !layer->commitChanges() )
if ( !provider->addFeatures( inFeatList ) )
{
QDomElement trElem = doc.createElement( "TransactionResult" );
QDomElement stElem = doc.createElement( "Status" );
@@ -1444,6 +1446,13 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
trElem.appendChild( locElem );

QDomElement mesElem = doc.createElement( "Message" );
QStringList mesErrors;
mesErrors << QString( "ERROR: %n feature(s) not added.").arg(inFeatList.size());
if ( provider->hasErrors() )
{
mesErrors << "\n Provider errors:" << provider->errors();
provider->clearErrors();
}
mesElem.appendChild( doc.createTextNode( layer->commitErrors().join( "\n " ) ) );
trElem.appendChild( mesElem );

0 comments on commit 5b41187

Please sign in to comment.