Skip to content

Commit

Permalink
WFS-T debugging and using provider for adding features
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Nov 30, 2012
1 parent 727d66a commit 5b41187
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/mapserver/qgswfsserver.cpp
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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" );
Expand All @@ -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 );

Expand Down

0 comments on commit 5b41187

Please sign in to comment.