Skip to content
Permalink
Browse files

[mssql] Show in browser also tables with invalid features

They will just have a generic vector icon

(cherry picked from commit 923adf2)
  • Loading branch information
wonder-sk authored and nyalldawson committed Nov 4, 2018
1 parent f1cfa1a commit 97cbf928f27af5a89489a12b7e10fc239b067bf6
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/providers/mssql/qgsmssqldataitems.cpp
@@ -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 )
@@ -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;

0 comments on commit 97cbf92

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