Skip to content
Permalink
Browse files

MSSQL revert geometryColumnTypes and homogenize

Other providers return an "invalid" col type from geometryColumnTypes
let's keep it that way (for now)
  • Loading branch information
elpaso committed Mar 14, 2020
1 parent 8eaf2bf commit 9a53cf2a3ea77db3823b5408d08ae3f99f6fb093
@@ -21,3 +21,7 @@ qgis_openclutilstest
# Relies on a broken/unreliable 3rd party service
qgis_layerdefinition

# MSSQL requires the MSSQL docker
PyQgsProviderConnectionMssql


@@ -193,10 +193,7 @@ void QgsAbstractDatabaseProviderConnection::TableProperty::addGeometryColumnType

QList<QgsAbstractDatabaseProviderConnection::TableProperty::GeometryColumnType> QgsAbstractDatabaseProviderConnection::TableProperty::geometryColumnTypes() const
{
if ( ! mGeometryColumn.isEmpty() )
return mGeometryColumnTypes;
else
return {};
return mGeometryColumnTypes;
}


@@ -391,6 +391,9 @@ QList<QgsMssqlProviderConnection::TableProperty> QgsMssqlProviderConnection::tab
}
else
{
// Add an invalid column
table.addGeometryColumnType( QgsWkbTypes::Type::NoGeometry,
QgsCoordinateReferenceSystem() );
table.setFlag( QgsMssqlProviderConnection::TableFlag::Aspatial );
}

@@ -201,7 +201,9 @@ def _test_operations(self, md, conn):
self.assertEqual(table_property.geometryColumn(), '')
self.assertEqual(table_property.defaultName(), 'myNewAspatialTable')
cols = table_property.geometryColumnTypes()
self.assertEqual(cols, [])
# We always return geom col types, even when there is no geometry
self.assertEqual(cols[0].wkbType, QgsWkbTypes.NoGeometry)
self.assertFalse(cols[0].crs.isValid())
self.assertFalse(table_property.flags() & QgsAbstractDatabaseProviderConnection.Raster)
self.assertFalse(table_property.flags() & QgsAbstractDatabaseProviderConnection.Vector)
self.assertTrue(table_property.flags() & QgsAbstractDatabaseProviderConnection.Aspatial)

0 comments on commit 9a53cf2

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