Skip to content

Commit

Permalink
MSSQL - Don't use spatial index if there is null values, calc extent …
Browse files Browse the repository at this point in the history
…instead.

Funded by Digital Mapping Solutions
  • Loading branch information
NathanW2 committed Feb 12, 2015
1 parent 1a60635 commit 1eaec17
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -601,9 +601,12 @@ void QgsMssqlProvider::UpdateStatistics( bool estimate )

if ( query.exec( statement ) )
{
QgsDebugMsg( "Found extents in spatial index" );
if ( query.next() )
if ( query.next() && ( !query.value( 0 ).isNull() ||
!query.value( 1 ).isNull() ||
!query.value( 2 ).isNull() ||
!query.value( 3 ).isNull() ) )
{
QgsDebugMsg( "Found extents in spatial index" );
mExtent.setXMinimum( query.value( 0 ).toDouble() );
mExtent.setYMinimum( query.value( 1 ).toDouble() );
mExtent.setXMaximum( query.value( 2 ).toDouble() );
Expand Down

0 comments on commit 1eaec17

Please sign in to comment.