[fdo-commits] r644 - branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common

svn_fdo at osgeo.org svn_fdo at osgeo.org
Wed Jan 17 15:33:31 EST 2007


Author: gavincramer
Date: 2007-01-17 15:33:30 -0500 (Wed, 17 Jan 2007)
New Revision: 644

Modified:
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp
Log:
ODBC: Fix Missing default spatial context

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp	2007-01-17 20:32:10 UTC (rev 643)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp	2007-01-17 20:33:30 UTC (rev 644)
@@ -156,18 +156,41 @@
 
 }
 
+static void ProcessSpatialContextReader( FdoISpatialContextReader * reader )
+{
+    int                         count = 0;
+
+    while ( reader->ReadNext() )
+    {
+        const wchar_t* sc_name = reader->GetName();
+        const wchar_t* cs_name = reader->GetCoordinateSystem();
+        const wchar_t* descr = reader->GetDescription();
+        const wchar_t* cs_wkt = reader->GetCoordinateSystemWkt();
+
+        FdoPtr<FdoByteArray> extent = reader->GetExtent();
+        FdoSpatialContextExtentType type = reader->GetExtentType();
+        bool is_active = reader->IsActive();
+
+        DBG(printf("\tsc_name=%ls\n\t\t   cs_name=%ls\n\t\t   descr=%ls\n\t\t   type=%d\n\t\t   active=%d\n", 
+                 sc_name, cs_name, descr, type, is_active));
+        DBG(printf("\tWKT: '%ls'\n", cs_wkt ));
+        count++;
+    }
+    DBG(printf("\t    retrieved %d SCs\n", count));
+    CPPUNIT_ASSERT( count >= 1 );
+}
+
 void FdoSqlCmdTest::doGetSC()
 {
-    FdoPtr<FdoRdbmsGetSpatialContexts> gscCmd;
-    FdoPtr<FdoISpatialContextReader> reader;
-    int                         n = 0;
-    bool        active_only = true;
-
-    DBG(printf("\n.Getting Spatial Contexts (active_only=%s)\n", active_only? "true":"false" ));
+    bool        active_only = false;
     if( mConnection != NULL )
     {
         try
         {
+            FdoPtr<FdoRdbmsGetSpatialContexts> gscCmd;
+            FdoPtr<FdoISpatialContextReader> reader;
+            DBG(printf("\n.Getting Spatial Contexts (active_only=%s)\n", active_only? "true":"false" ));
+
             ///////////////////////////////////////////////////////////////////////////////////////////
             // This will initialize for fetching the SC
             gscCmd = (FdoRdbmsGetSpatialContexts *)mConnection->CreateCommand( FdoCommandType_GetSpatialContexts );
@@ -177,28 +200,13 @@
             // Get a SC reader
             reader = gscCmd->Execute();
 
-            // Iterate ...
-            while ( reader->ReadNext() )
-            {
-                const wchar_t* sc_name = reader->GetName();
-    	        const wchar_t* cs_name = reader->GetCoordinateSystem();
-                const wchar_t* descr = reader->GetDescription();
-                const wchar_t* cs_wkt = reader->GetCoordinateSystemWkt();
+            ProcessSpatialContextReader(reader);
 
-                FdoPtr<FdoByteArray> extent = reader->GetExtent();
-                FdoSpatialContextExtentType type = reader->GetExtentType();
-                bool is_active = reader->IsActive();
-     
-                if ( true )
-                {
-                    DBG(printf("\tsc_name=%ls\n\t\t   cs_name=%ls\n\t\t   descr=%ls\n\t\t   type=%d\n\t\t   active=%d\n", 
-                             sc_name, cs_name, descr, type, is_active));
-                    DBG(printf("\tWKT: '%ls'\n", cs_wkt ));
-                }
-                n++;
-            }
-            if (true )
-                DBG(printf("\t    retrieved %d SCs\n", n));
+            ///////////////////////////////////////////////////////////////////////////////////////////
+            // Now try again, fetching all spatial contexts.
+            active_only = false;
+            reader = gscCmd->Execute();
+            ProcessSpatialContextReader(reader);
         }
         catch (FdoException *ex )
         {

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp	2007-01-17 20:32:10 UTC (rev 643)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp	2007-01-17 20:33:30 UTC (rev 644)
@@ -1787,6 +1787,7 @@
                     ( NULL != scName &&
                       (   wcscmp(scName, L"Default") == 0 ||
                         ( wcscmp(scName, L"survey1") == 0 && wcscmp(className, L"Sounding") == 0 ) ||
+                        ( wcscmp(scName, L"AcdbSc") == 0 && wcscmp(className, L"Table1") == 0 ) ||
                         ( wcscmp(scName, L"AcdbSc") == 0 && wcscmp(className, L"Polyline") == 0 ) ) );
                 CPPUNIT_ASSERT_MESSAGE("Wrong SpatialContextAssociation name", scNameOk);
                 if (!featureReader->IsNull(propName))



More information about the fdo-commits mailing list