Skip to content

Commit 97cbf92

Browse files
wonder-sknyalldawson
authored andcommittedNov 6, 2018
[mssql] Show in browser also tables with invalid features
They will just have a generic vector icon (cherry picked from commit 923adf2)
1 parent f1cfa1a commit 97cbf92

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎src/providers/mssql/qgsmssqldataitems.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@ void QgsMssqlConnectionItem::setLayerType( QgsMssqlLayerProperty layerProperty )
347347
layerProperty.srid = sridList[i];
348348
schemaItem->addLayer( layerProperty, true );
349349
}
350+
351+
if ( typeList.isEmpty() )
352+
{
353+
// this suggests that retrieval of geometry type and CRS failed if no results were returned
354+
// for examle due to invalid geometries in the table (WHAAAT?)
355+
// but we still want to add have such table in the list
356+
schemaItem->addLayer( layerProperty, true );
357+
}
350358
}
351359

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

0 commit comments

Comments
 (0)
Please sign in to comment.