[mapguide-commits] r9001 - in branches/3.1/MgDev: . Web/src/schemareport

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jul 26 09:54:53 PDT 2016


Author: jng
Date: 2016-07-26 09:54:52 -0700 (Tue, 26 Jul 2016)
New Revision: 9001

Modified:
   branches/3.1/MgDev/
   branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php
   branches/3.1/MgDev/Web/src/schemareport/showclass.php
Log:
Merged revision(s) 9000 from trunk/MgDev:
#2576: Use a MgFeatureQueryOptions with explicit property list when querying

This is to ensure that a "select * from featureclass" query from relational FDO providers will have its column list bounded to what is recognized in the class definition returned by the provider. Some providers are known to produce "select * from table" queries that "leak" out column types that the provider does not know how to process. Using an explicit property list from its class definition will allow us to avoid such issues.
........



Property changes on: branches/3.1/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000

Modified: branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php
===================================================================
--- branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php	2016-07-26 16:53:14 UTC (rev 9000)
+++ branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php	2016-07-26 16:54:52 UTC (rev 9001)
@@ -21,6 +21,65 @@
 
 <?php
 
+// Builds a MgFeatureQueryOptions with an explicit property list based
+// on the given class definition
+//
+// This is to ensure that a "select * from featureclass" query from relational
+// providers will have its column list bounded to what is recognized in the
+// class definition. Some providers are known to produce "select * from table"
+// queries that "leak" out column types that the provider does not know how to
+// process. Using an explicit property list from its class definition will
+// allow us to avoid such issues
+function BuildFeatureQueryOptions($classDef)
+{
+    $query = new MgFeatureQueryOptions();
+    $geomPropName = $classDef->GetDefaultGeometryPropertyName(); 
+    $propertyList = $classDef->GetProperties(); 
+
+    for ($i = 0; $i < $propertyList->GetCount(); $i++) 
+    {
+        $propertyDef = $propertyList->GetItem($i); 
+        $property = $propertyList->GetItem($i)->GetName(); 
+
+        if (($property != $geomPropName) && ($propertyDef->GetPropertyType() == MgFeaturePropertyType::DataProperty)) 
+        { 
+            $propertyType = $propertyList->GetItem($i)->GetDataType(); 
+            switch ($propertyType) { 
+                case MgPropertyType::Boolean: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::Byte: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::DateTime: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::Single: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::Double: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::Int16: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::Int32: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::Int64: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+                case MgPropertyType::String: 
+                    $query->AddFeatureProperty($property); 
+                    break; 
+            }
+        } else if ($property == $geomPropName){ 
+            $query->AddFeatureProperty($property); 
+        } 
+    }
+    return $query;
+}
+
 class MBR 
 {
     public $coordinateSystem;

Modified: branches/3.1/MgDev/Web/src/schemareport/showclass.php
===================================================================
--- branches/3.1/MgDev/Web/src/schemareport/showclass.php	2016-07-26 16:53:14 UTC (rev 9000)
+++ branches/3.1/MgDev/Web/src/schemareport/showclass.php	2016-07-26 16:54:52 UTC (rev 9001)
@@ -103,7 +103,8 @@
 
                 try
                 {
-                    $featureReader = $featureSrvc->SelectFeatures($resId, $qualifiedClassName, null);
+                    $query = BuildFeatureQueryOptions($classDef);
+                    $featureReader = $featureSrvc->SelectFeatures($resId, $qualifiedClassName, $query);
 
                     // Find the correct index on featureReader
                     $count = $index;



More information about the mapguide-commits mailing list