Skip to content
Permalink
Browse files
fix r15023: restore use of geometrytype as it's not deprecated and use
different geometry type notation

git-svn-id: http://svn.osgeo.org/qgis/trunk@15028 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jan 13, 2011
1 parent 79e8e07 commit c23bffc70b85eadbf3abcf07fae0fe2750c48489
Showing with 10 additions and 10 deletions.
  1. +6 −6 src/app/postgres/qgspgsourceselect.cpp
  2. +4 −4 src/providers/postgres/qgspostgresprovider.cpp
@@ -328,15 +328,15 @@ QString QgsPgSourceSelect::layerURI( const QModelIndex &index )

if ( typeName == "POINT" )
{
geomFilter = QString( "st_geometrytype(\"%1\") IN ('POINT','MULTIPOINT')" ).arg( geomColumnName );
geomFilter = QString( "geometrytype(\"%1\") IN ('POINT','MULTIPOINT')" ).arg( geomColumnName );
}
else if ( typeName == "LINESTRING" )
{
geomFilter = QString( "st_geometrytype(\"%1\") IN ('LINESTRING','MULTILINESTRING')" ).arg( geomColumnName );
geomFilter = QString( "geometrytype(\"%1\") IN ('LINESTRING','MULTILINESTRING')" ).arg( geomColumnName );
}
else if ( typeName == "POLYGON" )
{
geomFilter = QString( "st_geometrytype(\"%1\") IN ('POLYGON','MULTIPOLYGON')" ).arg( geomColumnName );
geomFilter = QString( "geometrytype(\"%1\") IN ('POLYGON','MULTIPOLYGON')" ).arg( geomColumnName );
}

if ( !geomFilter.isEmpty() && !sql.contains( geomFilter ) )
@@ -941,9 +941,9 @@ void QgsGeomColumnTypeThread::getLayerTypes()
{
QString query = QString( "select distinct "
"case"
" when st_geometrytype(%1) IN ('POINT','MULTIPOINT') THEN 'POINT'"
" when st_geometrytype(%1) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING'"
" when st_geometrytype(%1) IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON'"
" when geometrytype(%1) IN ('POINT','MULTIPOINT') THEN 'POINT'"
" when geometrytype(%1) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING'"
" when geometrytype(%1) IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON'"
" end "
"from " ).arg( "\"" + columns[i] + "\"" );
if ( mUseEstimatedMetadata )
@@ -3125,7 +3125,7 @@ bool QgsPostgresProvider::getGeometryDetails()
// Didn't find what we need in the geometry_columns table, so
// get stuff from the relevant column instead. This may (will?)
// fail if there is no data in the relevant table.
sql = QString( "select st_srid(%1),st_geometrytype(%1) from %2" )
sql = QString( "select st_srid(%1),geometrytype(%1) from %2" )
.arg( quotedIdentifier( geometryColumn ) )
.arg( mQuery );

@@ -3154,9 +3154,9 @@ bool QgsPostgresProvider::getGeometryDetails()
// check to see if there is a unique geometry type
sql = QString( "select distinct "
"case"
" when st_geometrytype(%1) IN ('POINT','MULTIPOINT') THEN 'POINT'"
" when st_geometrytype(%1) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING'"
" when st_geometrytype(%1) IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON'"
" when geometrytype(%1) IN ('POINT','MULTIPOINT') THEN 'POINT'"
" when geometrytype(%1) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING'"
" when geometrytype(%1) IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON'"
" end "
"from " ).arg( quotedIdentifier( geometryColumn ) );
if ( mUseEstimatedMetadata )

0 comments on commit c23bffc

Please sign in to comment.