Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSSQL: Support non spatial tables in browser dock #126

Merged
merged 1 commit into from
Apr 15, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/providers/mssql/qgsmssqldataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ QVector<QgsDataItem*> QgsMssqlConnectionItem::createChildren()
query += "sys.schemas.name, sys.objects.name, sys.columns.name, null, 'GEOMETRY' from sys.columns join sys.types on sys.columns.system_type_id = sys.types.system_type_id and sys.columns.user_type_id = sys.types.user_type_id join sys.objects on sys.objects.object_id = sys.columns.object_id join sys.schemas on sys.objects.schema_id = sys.schemas.schema_id where sys.types.name = 'geometry' or sys.types.name = 'geography' and sys.objects.type = 'U'";
}

if ( mAllowGeometrylessTables )
{
query += " union all select sys.schemas.name, sys.objects.name, null, null, 'NONE' from sys.objects join sys.schemas on sys.objects.schema_id = sys.schemas.schema_id where not exists (select * from sys.columns sc1 join sys.types on sc1.system_type_id = sys.types.system_type_id where (sys.types.name = 'geometry' or sys.types.name = 'geography') and sys.objects.object_id = sc1.object_id) and sys.objects.type = 'U'";
}

// issue the sql query
QSqlQuery q = QSqlQuery( db );
q.setForwardOnly( true );
Expand Down Expand Up @@ -488,7 +493,7 @@ QgsMssqlLayerItem* QgsMssqlSchemaItem::addLayer( QgsMssqlLayerProperty layerProp
layerType = QgsLayerItem::Polygon;
break;
default:
if ( layerProperty.type.isEmpty() && layerProperty.geometryColName.isEmpty() )
if ( layerProperty.type == "NONE" && layerProperty.geometryColName.isEmpty() )
{
layerType = QgsLayerItem::TableLayer;
tip = tr( "as geometryless table" );
Expand Down