Skip to content

Commit

Permalink
[mssql] Show in browser also tables with invalid features
Browse files Browse the repository at this point in the history
They will just have a generic vector icon
  • Loading branch information
wonder-sk committed Nov 4, 2018
1 parent 704959b commit 923adf2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/providers/mssql/qgsmssqldataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@ void QgsMssqlConnectionItem::setLayerType( QgsMssqlLayerProperty layerProperty )
layerProperty.srid = sridList[i];
schemaItem->addLayer( layerProperty, true );
}

if ( typeList.isEmpty() )
{
// this suggests that retrieval of geometry type and CRS failed if no results were returned
// for examle due to invalid geometries in the table (WHAAAT?)
// but we still want to add have such table in the list
schemaItem->addLayer( layerProperty, true );
}
}

bool QgsMssqlConnectionItem::equal( const QgsDataItem *other )
Expand Down Expand Up @@ -728,6 +736,11 @@ QgsMssqlLayerItem *QgsMssqlSchemaItem::addLayer( const QgsMssqlLayerProperty &la
layerType = QgsLayerItem::TableLayer;
tip = tr( "as geometryless table" );
}
else if ( !layerProperty.geometryColName.isEmpty() && layerProperty.type.isEmpty() )
{
// geometry column is there but we failed to determine geometry type (e.g. due to invalid geometries)
layerType = QgsLayerItem::Vector;
}
else
{
return nullptr;
Expand Down

0 comments on commit 923adf2

Please sign in to comment.