Skip to content
Permalink
Browse files

[mssql] Fix debug noise when reading features with null geometry

  • Loading branch information
nyalldawson committed Oct 3, 2018
1 parent af0ddb6 commit f6ecc8c08c38f98f81f4acb7b5a166394f0b93eb
Showing with 8 additions and 13 deletions.
  1. +8 −13 src/providers/mssql/qgsmssqlfeatureiterator.cpp
@@ -330,24 +330,19 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature &feature )

feature.setId( mQuery->record().value( mSource->mFidColName ).toLongLong() );

feature.clearGeometry();
if ( mSource->isSpatial() )
{
QByteArray ar = mQuery->record().value( mSource->mGeometryColName ).toByteArray();
unsigned char *wkb = mParser.ParseSqlGeometry( ( unsigned char * )ar.data(), ar.size() );
if ( wkb )
if ( !ar.isEmpty() )
{
QgsGeometry g;
g.fromWkb( wkb, mParser.GetWkbLen() );
feature.setGeometry( g );
if ( unsigned char *wkb = mParser.ParseSqlGeometry( ( unsigned char * )ar.data(), ar.size() ) )
{
QgsGeometry g;
g.fromWkb( wkb, mParser.GetWkbLen() );
feature.setGeometry( g );
}
}
else
{
feature.clearGeometry();
}
}
else
{
feature.clearGeometry();
}

feature.setValid( true );

0 comments on commit f6ecc8c

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