[QGIS Commit] r15028 - in trunk/qgis/src: app/postgres providers/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jan 12 20:08:58 EST 2011


Author: jef
Date: 2011-01-12 17:08:58 -0800 (Wed, 12 Jan 2011)
New Revision: 15028

Modified:
   trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
Log:
fix r15023: restore use of geometrytype as it's not deprecated and use
different geometry type notation

Modified: trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2011-01-12 23:14:28 UTC (rev 15027)
+++ trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2011-01-13 01:08:58 UTC (rev 15028)
@@ -328,15 +328,15 @@
 
     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 @@
     {
       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 )

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2011-01-12 23:14:28 UTC (rev 15027)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2011-01-13 01:08:58 UTC (rev 15028)
@@ -3125,7 +3125,7 @@
     // 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 @@
       // 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 )



More information about the QGIS-commit mailing list