[fdo-commits] r711 -
trunk/Providers/GenericRdbms/Src/UnitTest/Common
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Jan 29 15:22:05 EST 2007
Author: gavincramer
Date: 2007-01-29 15:22:02 -0500 (Mon, 29 Jan 2007)
New Revision: 711
Modified:
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp
trunk/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp
Log:
Port ODBC spatial context fix from 3.2.x to trunk
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp 2007-01-29 20:19:59 UTC (rev 710)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp 2007-01-29 20:22:02 UTC (rev 711)
@@ -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: trunk/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp 2007-01-29 20:19:59 UTC (rev 710)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp 2007-01-29 20:22:02 UTC (rev 711)
@@ -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