Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't add empty attribute fields to the insert statement in wfs-t (so…
…me servers complain about it)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14007 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 4, 2010
1 parent 4090e06 commit f49931b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/providers/wfs/qgswfsprovider.cpp
Expand Up @@ -261,10 +261,14 @@ bool QgsWFSProvider::addFeatures( QgsFeatureList &flist )
QgsAttributeMap::const_iterator valueIt = featureAttributes.find( fieldIt.key() );
if ( valueIt != featureAttributes.constEnd() )
{
QDomElement fieldElem = transactionDoc.createElementNS( mWfsNamespace, fieldIt.value().name() );
QDomText fieldText = transactionDoc.createTextNode( valueIt.value().toString() );
fieldElem.appendChild( fieldText );
featureElem.appendChild( fieldElem );
QVariant fieldValue = valueIt.value();
if ( fieldValue.isValid() && !fieldValue.isNull() )
{
QDomElement fieldElem = transactionDoc.createElementNS( mWfsNamespace, fieldIt.value().name() );
QDomText fieldText = transactionDoc.createTextNode( fieldValue.toString() );
fieldElem.appendChild( fieldText );
featureElem.appendChild( fieldElem );
}
}
}

Expand Down Expand Up @@ -2003,6 +2007,7 @@ bool QgsWFSProvider::sendTransactionDocument( const QDomDocument& doc, QDomDocum
QByteArray response = reply->readAll();
reply->deleteLater();
serverResponse.setContent( response, true );

return true;
}

Expand Down

0 comments on commit f49931b

Please sign in to comment.