[mapguide-commits] r6274 - trunk/MgDev/Web/src/schemareport

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Dec 2 04:56:55 EST 2011


Author: sparkliu
Date: 2011-12-02 01:56:55 -0800 (Fri, 02 Dec 2011)
New Revision: 6274

Modified:
   trunk/MgDev/Web/src/schemareport/showgeom.php
Log:
Fix ticket #1878 - Schema report will throw exception when view feature and there is no feature

This is because when there is no feature, COUNT will return a null value. We should add check on that.

Modified: trunk/MgDev/Web/src/schemareport/showgeom.php
===================================================================
--- trunk/MgDev/Web/src/schemareport/showgeom.php	2011-12-02 09:06:56 UTC (rev 6273)
+++ trunk/MgDev/Web/src/schemareport/showgeom.php	2011-12-02 09:56:55 UTC (rev 6274)
@@ -103,19 +103,28 @@
                         $dataReader = $featureSrvc->SelectAggregate($featuresId, $featureName, $query);
                         if ($dataReader->ReadNext())
                         {
-                            $ptype = $dataReader->GetPropertyType("TotalCount");
-                            switch ($ptype)
+                            // When there is no data, the property will be null.
+                            if($dataReader->IsNull("TotalCount"))
                             {
-                                case MgPropertyType::Int32:
-                                    $totalEntries = $dataReader->GetInt32("TotalCount");
-                                    $gotCount = true;
-                                    break;
-                                case MgPropertyType::Int64:
-                                    $totalEntries = $dataReader->GetInt64("TotalCount");
-                                    $gotCount = true;
-                                    break;
+                                $totalEntries = 0;
+                                $gotCount = true;
                             }
-                            $dataReader->Close();
+                            else
+                            {
+                                $ptype = $dataReader->GetPropertyType("TotalCount");
+                                switch ($ptype)
+                                {
+                                    case MgPropertyType::Int32:
+                                        $totalEntries = $dataReader->GetInt32("TotalCount");
+                                        $gotCount = true;
+                                        break;
+                                    case MgPropertyType::Int64:
+                                        $totalEntries = $dataReader->GetInt64("TotalCount");
+                                        $gotCount = true;
+                                        break;
+                                }
+                                $dataReader->Close();
+                            }
                         }
                     }
                 }



More information about the mapguide-commits mailing list