[fdo-commits] r794 - in
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest: . Common
MySql Odbc
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Thu Mar 15 08:39:06 EDT 2007
Author: brentrobinson
Date: 2007-03-15 08:39:06 -0400 (Thu, 15 Mar 2007)
New Revision: 794
Added:
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.h
Modified:
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoAdvancedSelectTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/Makefile.am
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/Makefile.am
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcDescribeSchemaTest.cpp
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcFdoInsertTest.h
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestMySql.vcproj
branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestOdbc.vcproj
Log:
Added various test cases.
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -422,3 +422,8 @@
return env;
}
+
+SchemaOverrideUtilP ConnectionUtil::NewSchemaOverrideUtil()
+{
+ return new SchemaOverrideUtil();
+}
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/ConnectionUtil.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -76,6 +76,7 @@
virtual FdoStringP GetEnviron( const char *name, FdoString *suffix = L"" );
virtual FdoStringP GetEnv( const char* name );
virtual StaticConnection* NewStaticConnection() = 0;
+ virtual SchemaOverrideUtilP NewSchemaOverrideUtil();
virtual void SetProvider( const char *providerName ) = 0;
virtual FdoInsertTest* GetInsertTest () = 0;
virtual FdoStringP GetOutputFileName (FdoString* pBaseFileName) = 0;
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -93,6 +93,25 @@
// FdoSchemaManagerP sm = connection->GetSchemaManager();
LoadTestData(connection /*, sm*/ );
+ printf( "Closing Connection ... \n" );
+ UnitTestUtil::CloseConnection(
+ connection,
+ false,
+ L"_describeschema"
+ );
+
+ printf( "Re-opening Connection ... \n" );
+ connection = UnitTestUtil::CreateConnection(
+ false,
+ false,
+ L"_describeschema",
+ NULL,
+ NULL,
+ 0
+ );
+
+ FdoPtr<FdoIConnectionCapabilities> conCap = connection->GetConnectionCapabilities();
+
printf( "Performing Describe ... \n" );
FdoPtr<FdoIDescribeSchema> pDescSchemaCmd = (FdoIDescribeSchema*) connection->CreateCommand(FdoCommandType_DescribeSchema);
FdoFeatureSchemasP fsc = pDescSchemaCmd->Execute();
@@ -113,7 +132,7 @@
FdoClassDefinitionP fc = FdoClassesP(fs->GetClasses())->GetItem( L"AcDbEntity" );
CPPUNIT_ASSERT( fc != NULL );
- /*
+
FdoClassCapabilitiesP cc = fc->GetCapabilities();
CPPUNIT_ASSERT( cc != NULL );
@@ -127,9 +146,11 @@
FdoInt32 lockTypeCount = 0;
FdoLockType* lockTypes = cc->GetLockTypes( lockTypeCount );
- CPPUNIT_ASSERT( lockTypeCount == 1 );
- CPPUNIT_ASSERT( lockTypes[0] == FdoLockType_Transaction );
- */
+ CPPUNIT_ASSERT( lockTypeCount == GetLockTypeCount() );
+ if ( GetLockTypeCount() > 0 ) {
+ CPPUNIT_ASSERT( lockTypes[0] == FdoLockType_Transaction );
+ }
+
// Verify that the feature class has the right system properties
// There are actually 5 system properties, but FeatId is omitted
// because AcDbEntity.ID gets grafted onto it.
@@ -175,6 +196,11 @@
}
}
+FdoInt32 DescribeSchemaTest::GetLockTypeCount()
+{
+ return 1;
+}
+
void DescribeSchemaTest::LoadTestData(FdoIConnection* connection/*, FdoRdbmsSchemaManager* sm*/)
{
static char* id_cols[] = { "ID" };
@@ -185,7 +211,7 @@
static char* custid_cols[] = { "NAME", "PROVINCE" };
// Create schema
- UnitTestUtil::Sql2Db( (const wchar_t**) mInputSchema, connection );
+ UnitTestUtil::Sql2Db( GetSchema(), connection );
// Load data
UnitTestUtil::Sql2Db( (const wchar_t**) mInputData, connection );
@@ -217,7 +243,9 @@
return true;
}
-const wchar_t* DescribeSchemaTest::mSchema[] = {
+FdoString** DescribeSchemaTest::GetSchema()
+{
+ static FdoString* theSchema[] = {
L"create table acdbentity (",
L" ID INT NOT NULL,",
L" LAYER VARCHAR(255)",
@@ -338,8 +366,10 @@
L" CUSTOMER_PROVINCE VARCHAR(50) NOT NULL",
L");",
NULL
-};
+ };
+ return theSchema;
+}
const wchar_t* DescribeSchemaTest::mData[] = {
L"",
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/DescribeSchemaTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -47,7 +47,9 @@
virtual void dropDb();
virtual void describe ();
void describe2 ();
+ virtual FdoInt32 GetLockTypeCount();
virtual void LoadTestData(FdoIConnection* connection/*, FdoSchemaManagerP sm*/);
+ virtual FdoString** GetSchema();
// Checks if a property is in a readonly property collection.
// Returns true if present.
bool Find_ROP( FdoReadOnlyPropertyDefinitionCollection* props, FdoString* propName );
@@ -55,7 +57,6 @@
const wchar_t** mInputSchema;
const wchar_t** mInputData;
- static const wchar_t* mSchema[];
static const wchar_t* mData[];
};
#endif //CPP_UNIT_DESCRIBESCHEMATEST_H
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoAdvancedSelectTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoAdvancedSelectTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoAdvancedSelectTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -50,22 +50,7 @@
{
try
{
- if (UnitTestUtil::DatastoreExists(DB_SUFFIX))
- mConnection = (FdoIConnection *) UnitTestUtil::GetConnection(DB_SUFFIX);
- else
- {
- mConnection = (FdoIConnection *) UnitTestUtil::GetConnection(DB_SUFFIX, true);
-
- // Insert the test data.
- FdoInsertTest *insert = new FdoInsertTest(DB_SUFFIX);
- insert->setUp();
- insert->insert();
- delete insert;
- insert = new FdoInsertTest(DB_SUFFIX);
- insert->setUp();
- insert->insert2();
- delete insert;
- }
+ mConnection = (FdoIConnection *) UnitTestUtil::GetConnection(DB_SUFFIX, true, true);
}
catch (FdoException *ex)
{
@@ -250,8 +235,18 @@
while ( myReader->ReadNext() )
{
count++;
- FdoString *testFunc = myReader->GetString(L"TestCompProp");
- printf("Computed id= %ls\n", testFunc);
+ FdoString *testFunc = NULL;
+ if (!myReader->IsNull(L"TestCompProp"))
+ {
+ testFunc = myReader->GetString(L"TestCompProp");
+ printf("Computed id= %ls\n", testFunc);
+ }
+ else
+ {
+ printf("Computed value is NULL.\n");
+ CPPUNIT_ASSERT_MESSAGE( "Computed value is NULL", false );
+ }
+
FdoInt32 segcount = myReader->GetInt32(L"segcount");
if (!myReader->IsNull(L"xdata2"))
{
@@ -785,7 +780,10 @@
{
double testFunc = myDataReader->GetDouble(L"TestFunc");
printf("Sum(xdata2.seq) = %f\n", testFunc );
+//Remove this ifndef when defect 917635 is fixed.
+#ifndef RDBI_DEF_SA_ORA
CPPUNIT_ASSERT_MESSAGE("Wrong sum(xdata2.seq) returned", testFunc==3.0);
+#endif
}
}
}
@@ -1321,7 +1319,10 @@
try
{
myDataReader = selCmdAggreg->Execute();
- TestCommonFail(FdoException::Create(L"TestUpperDateProperty should fail!"));
+// Remove ifndef when defect 917671 is fixed
+#ifndef RDBI_DEF_SA_ORA
+ TestCommonFail(FdoException::Create(L"TestMaxBoolProperty should fail!"));
+#endif
}
catch( FdoException *ex )
{
@@ -1351,7 +1352,10 @@
try
{
myDataReader = selCmdAggreg->Execute();
+// Remove ifndef when defect 917671 is fixed
+#ifndef RDBI_DEF_SA_ORA
TestCommonFail(FdoException::Create(L"TestUpperDateProperty should fail!"));
+#endif
}
catch( FdoException *ex )
{
@@ -1380,7 +1384,10 @@
try
{
myDataReader = selCmdAggreg->Execute();
- TestCommonFail(FdoException::Create(L"TestUpperDateProperty should fail!"));
+// Remove ifndef when defect 917671 is fixed
+#ifndef RDBI_DEF_SA_ORA
+ TestCommonFail(FdoException::Create(L"TestCeilInt64Property should fail!"));
+#endif
}
catch( FdoException *ex )
{
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -648,7 +648,7 @@
fdoClasses->RemoveAt( fdoClasses->IndexOf(L"view_op") );
FdoRdbmsOvSchemaMappingP mapping = (FdoRdbmsOvPhysicalSchemaMapping*) mappings->GetItem( connection, pSchema->GetName());
- ShemaOvSetOwner(mapping, UnitTestUtil::GetEnviron("datastore", DB_NAME_OVERRIDE_SUFFIX) );
+ SchemaOvSetOwner(mapping, UnitTestUtil::GetEnviron("datastore", DB_NAME_OVERRIDE_SUFFIX) );
// Apply the foreign schema
FdoPtr<FdoIApplySchema> pApplyCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
@@ -5970,3 +5970,98 @@
else
return UnitTestUtil::GetOutputFileName( FdoStringP::Format( L"apply_schema_overrides_err%d%ls.txt", fileNum, L"_master") );
}
+
+FdoRdbmsOvClassDefinition* FdoApplySchemaTest::CreateOvClassDefinition(FdoString *name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvClassDefinition(name);
+}
+
+void FdoApplySchemaTest::ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->ClassesOvAdd(pSchema, pClass);
+}
+
+FdoRdbmsOvTable* FdoApplySchemaTest::CreateOvTable(FdoString* name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvTable(name);
+}
+
+FdoRdbmsOvColumn* FdoApplySchemaTest::CreateOvColumn(FdoString* name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvColumn(name);
+}
+
+FdoRdbmsOvGeometricColumn* FdoApplySchemaTest::CreateOvGeometricColumn(FdoString* name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvGeometricColumn(name);
+}
+
+FdoRdbmsOvDataPropertyDefinition* FdoApplySchemaTest::CreateOvDataPropertyDefinition(FdoString *name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvDataPropertyDefinition(name);
+}
+
+FdoRdbmsOvGeometricPropertyDefinition* FdoApplySchemaTest::CreateOvGeometricPropertyDefinition(FdoString *name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvGeometricPropertyDefinition(name);
+}
+
+void FdoApplySchemaTest::PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->PropertiesOvAdd(pClass, pProp);
+}
+
+void FdoApplySchemaTest::ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->ClassOvSetTable(pClass, pTable);
+}
+
+void FdoApplySchemaTest::TableOvSetTablespace(FdoRdbmsOvTable* pTable, FdoString *tablespace)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->TableOvSetTablespace(pTable, tablespace);
+}
+
+void FdoApplySchemaTest::DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->DataPropOvSetColumn(pDataProp, pDataColumn);
+}
+
+void FdoApplySchemaTest::GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->GeometricPropOvSetColumn(pGeomProp, pGeometricColumn);
+}
+
+void FdoApplySchemaTest::ColumnOvSetSequence(FdoRdbmsOvColumn* pColumn, FdoString *sequence)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->ColumnOvSetSequence(pColumn, sequence);
+}
+
+FdoRdbmsOvObjectPropertyDefinition* FdoApplySchemaTest::CreateOvObjectPropertyDefinition(FdoString *name)
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvObjectPropertyDefinition(name);
+}
+
+FdoRdbmsOvPropertyMappingSingle* FdoApplySchemaTest::CreateOvPropertyMappingSingle()
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvPropertyMappingSingle();
+}
+
+FdoRdbmsOvPropertyMappingConcrete* FdoApplySchemaTest::CreateOvPropertyMappingConcrete()
+{
+ return UnitTestUtil::NewSchemaOverrideUtil()->CreateOvPropertyMappingConcrete();
+}
+
+void FdoApplySchemaTest::ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->ObjectPropertyOvSetMappingDefinition(pObProp, mapping);
+}
+
+void FdoApplySchemaTest::PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->PropertyMappingOvSetInternalClass(pMapping, pClass);
+}
+
+void FdoApplySchemaTest::SchemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner)
+{
+ UnitTestUtil::NewSchemaOverrideUtil()->SchemaOvSetOwner(mapping, owner);
+}
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -137,25 +137,25 @@
// Helper methods for overrides tests; need to be overriden for each provider:
virtual void CreateRdbmsSpecificElements(FdoIConnection* connection, FdoString* wDatastore) { };
- virtual FdoRdbmsOvClassDefinition* CreateOvClassDefinition(FdoString *name = NULL) { return NULL; };
- virtual void ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass) {};
- virtual FdoRdbmsOvTable* CreateOvTable(FdoString* name) { return NULL; };
- virtual FdoRdbmsOvColumn* CreateOvColumn(FdoString* name) { return NULL; };
- virtual FdoRdbmsOvGeometricColumn* CreateOvGeometricColumn(FdoString* name) { return NULL; };
- virtual FdoRdbmsOvDataPropertyDefinition* CreateOvDataPropertyDefinition(FdoString *name) { return NULL; };
- virtual FdoRdbmsOvGeometricPropertyDefinition* CreateOvGeometricPropertyDefinition(FdoString *name) { return NULL; };
- virtual void PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp) {};
- virtual void ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable) {};
- virtual void TableOvSetTablespace(FdoRdbmsOvTable* pTable, FdoString *tablespace) {};
- virtual void DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn) {};
- virtual void GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn) {};
- virtual void ColumnOvSetSequence(FdoRdbmsOvColumn* pColumn, FdoString *sequence) {};
- virtual FdoRdbmsOvObjectPropertyDefinition* CreateOvObjectPropertyDefinition(FdoString *name) { return NULL; };
- virtual FdoRdbmsOvPropertyMappingSingle* CreateOvPropertyMappingSingle() { return NULL; };
- virtual FdoRdbmsOvPropertyMappingConcrete* CreateOvPropertyMappingConcrete() { return NULL; };
- virtual void ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping) {};
- virtual void PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass) {};
- virtual void ShemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner) {};
+ virtual FdoRdbmsOvClassDefinition* CreateOvClassDefinition(FdoString *name = NULL);
+ virtual void ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass);
+ virtual FdoRdbmsOvTable* CreateOvTable(FdoString* name);
+ virtual FdoRdbmsOvColumn* CreateOvColumn(FdoString* name);
+ virtual FdoRdbmsOvGeometricColumn* CreateOvGeometricColumn(FdoString* name);
+ virtual FdoRdbmsOvDataPropertyDefinition* CreateOvDataPropertyDefinition(FdoString *name);
+ virtual FdoRdbmsOvGeometricPropertyDefinition* CreateOvGeometricPropertyDefinition(FdoString *name);
+ virtual void PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp);
+ virtual void ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable);
+ virtual void TableOvSetTablespace(FdoRdbmsOvTable* pTable, FdoString *tablespace);
+ virtual void DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn);
+ virtual void GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn);
+ virtual void ColumnOvSetSequence(FdoRdbmsOvColumn* pColumn, FdoString *sequence);
+ virtual FdoRdbmsOvObjectPropertyDefinition* CreateOvObjectPropertyDefinition(FdoString *name);
+ virtual FdoRdbmsOvPropertyMappingSingle* CreateOvPropertyMappingSingle();
+ virtual FdoRdbmsOvPropertyMappingConcrete* CreateOvPropertyMappingConcrete();
+ virtual void ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping);
+ virtual void PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass);
+ virtual void SchemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner);
virtual void VldClassCapabilities( int ltMode, int lckMode, FdoClassDefinition* pClass );
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -36,7 +36,7 @@
mSuffix[0] = '\0';
}
-FdoInsertTest::FdoInsertTest(wchar_t *suffix)
+FdoInsertTest::FdoInsertTest(FdoString *suffix)
{
m_DisableFailures = false;
wcsncpy(mSuffix, suffix, 11 );
@@ -310,24 +310,30 @@
dataValue = FdoDataValue::Create(L"Ontario");
propertyValue = AddNewProperty( propertyValues3, L"Pr\x00f6vince");
propertyValue->SetValue(dataValue);
- char id[16];
- sprintf(id,"P%d_%d",feat,count1);
- FdoStringP str( id );
- dataValue = FdoDataValue::Create((FdoString*)str);
+ FdoStringP id = FdoStringP::Format(L"P%d_%d",feat,count1);
+ dataValue = FdoDataValue::Create((FdoString*) id);
propertyValue = AddNewProperty( propertyValues3, L"PIN");
propertyValue->SetValue(dataValue);
propertyValue = AddNewProperty( propertyValues3, L"Geometry");
propertyValue->SetValue(geometryValue);
- if( count1 > 7 )
+// if( count1 > 7 )
{
FdoPtr<FdoIFeatureReader> reader4 = insertCommand3->Execute();
while( reader4->ReadNext() ) {
+//Remove this ifdef when defect 918057 fixed
+#ifdef RDBI_DEF_SA_ORA
+ if( !reader4->IsNull( L"PIN" ) ) {
+ FdoString* pin = reader4->GetString(L"PIN");
+ DBG(printf("inserted pin=%ls\n", pin));
+ }
+#else
if( !reader4->IsNull( L"FeatId" ) ) {
FdoInt64 featid = reader4->GetInt64(L"FeatId");
DBG(printf("inserted featid=%ld\n", featid));
}
+#endif
}
}
@@ -496,6 +502,7 @@
{
double coordsBuffer[400];
int segCount = 2;
+ bool supportsZ = (FdoPtr<FdoIGeometryCapabilities>(connection->GetGeometryCapabilities())->GetDimensionalities() & FdoDimensionality_Z);
FdoPtr<FdoPropertyValue> propertyValue;
@@ -506,14 +513,22 @@
FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
- // Use 2D points to accomodate MySql
- coordsBuffer[0] = 1.1;
- coordsBuffer[1] = 2.2;
- coordsBuffer[2] = 1.1;
- coordsBuffer[3] = 3.3;
+ int ord = 0;
+ coordsBuffer[ord++] = 1.1;
+ coordsBuffer[ord++] = 2.2;
+ if ( supportsZ )
+ coordsBuffer[ord++] = 0.0;
+ coordsBuffer[ord++] = 1.1;
+ coordsBuffer[ord++] = 3.3;
+ if ( supportsZ )
+ coordsBuffer[ord++] = 0.0;
propertyValue = AddNewProperty( propertyValues, L"Geometry");
- FdoPtr<FdoILineString> line1 = gf->CreateLineString(FdoDimensionality_XY, 2*2, coordsBuffer);
+ FdoPtr<FdoILineString> line1 = gf->CreateLineString(
+ supportsZ ? FdoDimensionality_XY|FdoDimensionality_Z : FdoDimensionality_XY,
+ ord,
+ coordsBuffer
+ );
FdoPtr<FdoByteArray> byteArray = gf->GetFgf(line1);
FdoPtr<FdoGeometryValue> geometryValue = FdoGeometryValue::Create(byteArray);
@@ -789,8 +804,12 @@
featureReader = selectCmd->Execute();
CPPUNIT_ASSERT(featureReader->ReadNext());
+
+// Reinstate when defect 917085 is fixed.
+#ifndef RDBI_DEF_ORA
CPPUNIT_ASSERT ( featureReader->GetInt64(L"int64") == (GetMaxInt64Value() - 1) );
CPPUNIT_ASSERT ( featureReader->GetSingle(L"single") == GetSmallestSingleValue() );
+#endif
// CPPUNIT_ASSERT ( featureReader->GetDouble(L"double") == GetSmallestDoubleValue() );
insertBoundaryCleanup( connection );
@@ -1294,7 +1313,7 @@
L"aaaaaaaaaabbbbiiiii",
L"3333"};
- connection = UnitTestUtil::GetConnection(L"LT", true, Connection_WithDatastore, 1, true );
+ connection = UnitTestUtil::GetConnection(L"LT", true, true, Connection_WithDatastore, 1, true );
// Setup the long transaction environment required for this test.
// NOTE: The long transaction names are prefixed with the current user
@@ -1589,3 +1608,543 @@
throw;
}
}
+
+void FdoInsertTest::insertLongString()
+{
+ try
+ {
+
+ FdoPtr<FdoIConnection> connection = UnitTestUtil::GetConnection(mSuffix, true);
+
+ try
+ {
+ //delete row
+ FdoPtr<FdoISQLCommand> delCmd = (FdoISQLCommand*)connection->CreateCommand( FdoCommandType_SQLCommand );
+ delCmd->SetSQLStatement(L"delete from ACDBENTITY_ACXDATA_ACXOBJ where intdata=200");
+ delCmd->ExecuteNonQuery();
+
+ FdoIInsert *insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
+ insertCommand->SetFeatureClassName(L"Acad:AcDb3dPolyline");
+ FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
+
+ FdoPtr<FdoDataValue> dataValue;
+ FdoPtr<FdoPropertyValue> propertyValue;
+
+ dataValue = FdoDataValue::Create(L"256");
+ propertyValue = AddNewProperty( propertyValues,L"color");
+ propertyValue->SetValue(dataValue);
+
+ dataValue = FdoDataValue::Create(0);
+ propertyValue = AddNewProperty( propertyValues, L"segcount");
+ propertyValue->SetValue(dataValue);
+
+ dataValue = FdoDataValue::Create(200);
+ propertyValue = AddNewProperty( propertyValues, L"layer");
+ propertyValue->SetValue(dataValue);
+
+ dataValue = FdoDataValue::Create(1);
+ propertyValue = AddNewProperty( propertyValues, L"xdata.seq");
+ propertyValue->SetValue(dataValue);
+
+ dataValue = FdoDataValue::Create(L"xyz");
+ propertyValue = AddNewProperty( propertyValues, L"xdata.DataValue");
+ propertyValue->SetValue(dataValue);
+
+ dataValue = FdoDataValue::Create(200);
+ propertyValue = AddNewProperty( propertyValues, L"xdata.AcXObj.intdata");
+ propertyValue->SetValue(dataValue);
+ // Generate very long string
+ FdoStringP strData = L"abcdefghi";
+ for (int i=1; i<400; i++)
+ strData += L"abcdefghij";
+ strData += L"X";
+ dataValue = FdoDataValue::Create(strData);
+ propertyValue = AddNewProperty( propertyValues, L"xdata.AcXObj.strdata");
+ propertyValue->SetValue(dataValue);
+
+ FdoPtr<FdoIFeatureReader> reader = insertCommand->Execute();
+ CPPUNIT_ASSERT(reader != NULL);
+ reader->Close();
+ FdoISelect *selCmd;
+ selCmd = (FdoISelect*)connection->CreateCommand( FdoCommandType_Select );
+ selCmd->SetFeatureClassName(L"Acad:AcDb3dPolyline.xdata.AcXObj");
+ FdoComparisonCondition* filterPtr = FdoComparisonCondition::Create(
+ FdoPtr<FdoIdentifier> (FdoIdentifier::Create(L"intdata")),
+ FdoComparisonOperations_EqualTo,
+ FdoPtr<FdoDataValue>(FdoDataValue::Create((int)200)));
+ selCmd->SetFilter(filterPtr);
+ filterPtr->Release();
+ reader = selCmd->Execute();
+ CPPUNIT_ASSERT(reader != NULL);
+ while (reader->ReadNext())
+ {
+ if (!reader->IsNull(L"strdata"))
+ {
+ FdoStringP strSel = reader->GetString(L"strdata");
+ CPPUNIT_ASSERT(strSel.ICompare(strData) == 0);
+ }
+ }
+ reader->Close();
+ connection->Close();
+ }
+ catch (...)
+ {
+ if (connection)
+ connection->Close ();
+ throw;
+ }
+ }
+ catch (FdoCommandException *ex)
+ {
+ UnitTestUtil::FailOnException(ex);
+ }
+ catch (FdoException *ex)
+ {
+ UnitTestUtil::FailOnException(ex);
+ }
+}
+
+void FdoInsertTest::featureReaderTest()
+{
+
+ bool featureReaderError = false;
+ FdoIConnection *connection = NULL;
+ FdoIApplySchema *applySchemaCmd = NULL;
+ FdoPtr<FdoFeatureSchemaCollection> schemas;
+ FdoFeatureSchema *schema = NULL;
+ FdoClass *schemaClass = NULL;
+ FdoFeatureClass *schemaFeatureClass = NULL;
+ FdoClassCollection *classes = NULL;
+ FdoIFeatureReader *featureReader = NULL;
+
+ try
+ {
+ printf(" >>> Feature Reader Test \n");
+
+ // Create the data store used for the test. Note that none of the
+ // standard schemas is created.
+ printf(" >>> ... creating test database \n");
+ if (UnitTestUtil::DatastoreExists(L"_frc"))
+ UnitTestUtil::DropDb(L"_frc");
+ UnitTestUtil::CreateDB(false, false, L"_frc");
+
+ // Connect and create the test schema.
+ connection = UnitTestUtil::GetConnection(L"_frc");
+
+ printf(" >>> ... creating test schema FeatureReaderCheck \n");
+ applySchemaCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
+ schemas = FdoFeatureSchemaCollection::Create(NULL);
+ schema = FdoFeatureSchema::Create(L"FeatureReaderCheck", L"Feature Reader Check Schema");
+ classes = schema->GetClasses();
+
+ // Add a class with the feature id property as its sole identity property. In this case
+ // use the identifier FeatId for the feature id property.
+ printf(" >>> ...... adding class FRC_SSFIDC \n");
+ schemaFeatureClass = CreateFdoFeatureClass(L"FRC_SSFIDC", L"FeatId", NULL, 1);
+ classes->Add(schemaFeatureClass);
+ FDO_SAFE_RELEASE(schemaFeatureClass);
+
+ // Add a class with the feature id property as its sole identity property. In this case
+ // use the identifier FeatureId for the feature id property.
+ printf(" >>> ...... adding class FRC_SCFIDC \n");
+ schemaFeatureClass = CreateFdoFeatureClass(L"FRC_SCFIDC", L"FeatureId", NULL, 1);
+ classes->Add(schemaFeatureClass);
+ FDO_SAFE_RELEASE(schemaFeatureClass);
+
+ // Add a class with two identity properties. The identity properties do not
+ // include the feature id property.
+ printf(" >>> ...... adding class FRC_MIDC \n");
+ schemaFeatureClass = CreateFdoFeatureClass(L"FRC_MIDC", L"Id1", L"Id2", 2);
+ classes->Add(schemaFeatureClass);
+ FDO_SAFE_RELEASE(schemaFeatureClass);
+
+ // Add a class with two identity properties. The identity properties do include
+ // the feature id property.
+ printf(" >>> ...... adding class FRC_MIDWFIDC \n");
+ schemaFeatureClass = CreateFdoFeatureClass(L"FRC_MIDWFIDC", L"Id1", L"FeatureId", 3);
+ classes->Add(schemaFeatureClass);
+ FDO_SAFE_RELEASE(schemaFeatureClass);
+
+ // Add a non-feature class.
+ printf(" >>> ...... adding class FRC_NFC \n");
+ schemaClass = CreateFdoClass(L"FRC_NFC");
+ classes->Add(schemaClass);
+ FDO_SAFE_RELEASE(schemaClass);
+
+ schemas->Add(schema);
+ applySchemaCmd->SetFeatureSchema(schema);
+ printf(" >>> ...... applying schema \n");
+ applySchemaCmd->Execute();
+
+ FDO_SAFE_RELEASE(classes);
+ FDO_SAFE_RELEASE(schema);
+ FDO_SAFE_RELEASE(applySchemaCmd);
+
+
+ printf(" >>> ... insert data and check the returned feature reader \n");
+ printf(" >>> ...... processing class FRC_SSFIDC \n");
+ featureReader = AddFeature(connection, L"FRC_SSFIDC", true, 1);
+ featureReader->ReadNext();
+ try
+ {
+ FdoInt64 fid = featureReader->GetInt64(L"FeatId");
+ }
+ catch (...)
+ {
+ printf(" >>> ......... Feature Reader Error for class FRC_SSFIDC \n");
+ featureReaderError = true;
+ }
+ FDO_SAFE_RELEASE(featureReader);
+
+ printf(" >>> ...... processing class FRC_SCFIDC \n");
+ featureReader = AddFeature(connection, L"FRC_SCFIDC", true, 1);
+ featureReader->ReadNext();
+ try
+ {
+ FdoInt64 fid = featureReader->GetInt64(L"FeatureId");
+ }
+ catch (...)
+ {
+ printf(" >>> ......... Feature Reader Error for class FRC_SCFIDC \n");
+ featureReaderError = true;
+ }
+ FDO_SAFE_RELEASE(featureReader);
+
+ printf(" >>> ...... processing class FRC_MIDC \n");
+ featureReader = AddFeature(connection, L"FRC_MIDC", true, 2);
+ featureReader->ReadNext();
+//Remove this ifdef when defect 918057 fixed
+#ifdef RDBI_DEF_SA_ORA
+ try
+ {
+ FdoStringP id1str = featureReader->GetString(L"Id1");
+ FdoStringP id2str = featureReader->GetString(L"Id2");
+ }
+ catch (...)
+ {
+ printf(" >>> ......... Feature Reader Error for class FRC_MIDC \n");
+ featureReaderError = true;
+ }
+#endif
+ FDO_SAFE_RELEASE(featureReader);
+
+ printf(" >>> ...... processing class FRC_MIDWFIDC \n");
+ featureReader = AddFeature(connection, L"FRC_MIDWFIDC", true, 3);
+ featureReader->ReadNext();
+//Remove this ifdef when defect 918057 fixed
+#ifdef RDBI_DEF_SA_ORA
+ try
+ {
+ FdoStringP id1str = featureReader->GetString(L"Id1");
+ FdoInt64 fid = featureReader->GetInt64(L"FeatureId");
+ }
+ catch (...)
+ {
+ printf(" >>> ......... Feature Reader Error for class FRC_MIDWFIDC \n");
+ featureReaderError = true;
+ }
+#endif
+ FDO_SAFE_RELEASE(featureReader);
+
+ printf(" >>> ...... processing class FRC_NFC \n");
+ featureReader = AddFeature(connection, L"FRC_NFC", false, 0);
+ featureReader->ReadNext();
+//Remove this ifdef when defect 918057 fixed
+#ifdef RDBI_DEF_SA_ORA
+ try
+ {
+ FdoInt32 fid = featureReader->GetInt32(L"xid");
+ }
+ catch (...)
+ {
+ printf(" >>> ......... Feature Reader Error for class FRC_NFC \n");
+ featureReaderError = true;
+ }
+#endif
+ FDO_SAFE_RELEASE(featureReader);
+
+ connection->Close();
+ if (featureReaderError)
+ throw FdoException::Create(L"Feature Reader Test Failed");
+ printf(" >>> Feature Reader Test Succeeded\n");
+ }
+
+ catch (FdoException *exp)
+ {
+ printf(" >>> Exception: %ls\n", exp->GetExceptionMessage());
+ connection->Close ();
+ FDO_SAFE_RELEASE(classes);
+ FDO_SAFE_RELEASE(schema);
+ FDO_SAFE_RELEASE(applySchemaCmd);
+ TestCommonFail(exp);
+ }
+
+ catch (...)
+ {
+ if ( connection ) connection->Close ();
+ FDO_SAFE_RELEASE(classes);
+ FDO_SAFE_RELEASE(schema);
+ FDO_SAFE_RELEASE(applySchemaCmd);
+ throw;
+ }
+}
+
+FdoIFeatureReader *FdoInsertTest::AddFeature (FdoIConnection *connection, FdoString *className, bool isSpatial, int idScenario)
+{
+ double coordinateBuffer[5];
+ FdoIInsert *insertCommand = NULL;
+ FdoDataValue *dataValue = NULL;
+ FdoByteArray *byteArray = NULL;
+ FdoILineString *lineStr = NULL;
+ FdoGeometryValue *geometryValue = NULL;
+ FdoPropertyValue *propertyValue = NULL;
+ FdoIFeatureReader *featureReader = NULL;
+ FdoFgfGeometryFactory *geometryFactory = NULL;
+ FdoPropertyValueCollection *propertyValues = NULL;
+
+ try
+ {
+ insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
+ insertCommand->SetFeatureClassName(className);
+ propertyValues = insertCommand->GetPropertyValues();
+
+ if (isSpatial)
+ {
+ coordinateBuffer[0] = 100.0;
+ coordinateBuffer[1] = 100.0;
+ coordinateBuffer[2] = 101.0;
+ coordinateBuffer[3] = 101.0;
+
+ geometryFactory = FdoFgfGeometryFactory::GetInstance();
+ lineStr = geometryFactory->CreateLineString(
+ FdoDimensionality_XY,
+ 4,
+ coordinateBuffer);
+ byteArray = geometryFactory->GetFgf(lineStr);
+ geometryValue = FdoGeometryValue::Create(byteArray);
+
+ propertyValue = AddNewProperty(propertyValues, L"RDBMS_GEOM");
+ propertyValue->SetValue(geometryValue);
+ FDO_SAFE_RELEASE(geometryValue);
+ FDO_SAFE_RELEASE(lineStr);
+ FDO_SAFE_RELEASE(byteArray);
+ FDO_SAFE_RELEASE(geometryValue);
+ FDO_SAFE_RELEASE(propertyValue);
+ }
+ else
+ {
+ dataValue = FdoDataValue::Create(L"1001");
+ propertyValue = AddNewProperty(propertyValues, L"xid");
+ propertyValue->SetValue(dataValue);
+ FDO_SAFE_RELEASE(propertyValue);
+ FDO_SAFE_RELEASE(dataValue);
+ }
+
+ switch (idScenario)
+ {
+ case 1: // Single identity property representing the feature id property.
+ //Nothing to do.
+ break;
+
+ case 2: // Multiple identity properties; no feature id property included.
+ dataValue = FdoDataValue::Create(L"1001");
+ propertyValue = AddNewProperty(propertyValues, L"Id1");
+ propertyValue->SetValue(dataValue);
+ FDO_SAFE_RELEASE(dataValue);
+ FDO_SAFE_RELEASE(propertyValue);
+
+ dataValue = FdoDataValue::Create(L"1001");
+ propertyValue = AddNewProperty(propertyValues, L"Id2");
+ propertyValue->SetValue(dataValue);
+ FDO_SAFE_RELEASE(dataValue);
+ FDO_SAFE_RELEASE(propertyValue);
+ break;
+
+ case 3: // Multiple identity properties; feature id property included.
+ dataValue = FdoDataValue::Create(L"1001");
+ propertyValue = AddNewProperty(propertyValues, L"Id1");
+ propertyValue->SetValue(dataValue);
+ FDO_SAFE_RELEASE(dataValue);
+ FDO_SAFE_RELEASE(propertyValue);
+ break;
+ }
+
+ dataValue = FdoDataValue::Create(L"Blue");
+ propertyValue = AddNewProperty(propertyValues, L"color");
+ propertyValue->SetValue(dataValue);
+ FDO_SAFE_RELEASE(dataValue);
+ FDO_SAFE_RELEASE(propertyValue);
+
+ featureReader = insertCommand->Execute();
+
+ FDO_SAFE_RELEASE(propertyValues);
+ FDO_SAFE_RELEASE(insertCommand);
+
+ return featureReader;
+
+ } // try ...
+
+ catch ( ... )
+ {
+ FDO_SAFE_RELEASE(propertyValue);
+ FDO_SAFE_RELEASE(geometryValue);
+ FDO_SAFE_RELEASE(lineStr);
+ FDO_SAFE_RELEASE(byteArray);
+ FDO_SAFE_RELEASE(geometryValue);
+ FDO_SAFE_RELEASE(dataValue);
+ FDO_SAFE_RELEASE(propertyValues);
+ FDO_SAFE_RELEASE(insertCommand);
+ throw;
+ }
+}
+
+FdoDataPropertyDefinition *FdoInsertTest::CreateDataProperty (FdoString *propertyName,
+ FdoDataType dataType,
+ FdoInt32 dataSize,
+ bool isNullable)
+{
+ FdoDataPropertyDefinition *dataPropertyDefinition = NULL;
+
+ dataPropertyDefinition = FdoDataPropertyDefinition::Create(propertyName, propertyName);
+ dataPropertyDefinition->SetDataType(dataType);
+ if (dataType == FdoDataType_String)
+ dataPropertyDefinition->SetLength(dataSize);
+ dataPropertyDefinition->SetNullable(isNullable);
+ return dataPropertyDefinition;
+}
+
+FdoClass *FdoInsertTest::CreateFdoClass (FdoString *className)
+{
+ FdoClass *theClass = NULL;
+ FdoDataPropertyDefinition *dataPropertyDefinition = NULL;
+ FdoPropertyDefinitionCollection *dataPropertyDefinitions = NULL;
+ FdoDataPropertyDefinitionCollection *idPropertyDefinitions = NULL;
+
+ try
+ {
+ theClass = FdoClass::Create(className, className);
+ theClass->SetIsAbstract(false);
+ dataPropertyDefinitions = theClass->GetProperties();
+ idPropertyDefinitions = theClass->GetIdentityProperties();
+
+ dataPropertyDefinition = CreateDataProperty(L"xid", FdoDataType_Int32, 0, false);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ idPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+
+ dataPropertyDefinition = CreateDataProperty(L"color", FdoDataType_String, 30, false);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+
+ FDO_SAFE_RELEASE(idPropertyDefinitions);
+ FDO_SAFE_RELEASE(dataPropertyDefinitions);
+
+ return theClass;
+ }
+
+ catch ( ... )
+ {
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(idPropertyDefinitions);
+ FDO_SAFE_RELEASE(dataPropertyDefinitions);
+
+ throw;
+ }
+}
+
+FdoFeatureClass *FdoInsertTest::CreateFdoFeatureClass (FdoString *className,
+ FdoString *idColName1,
+ FdoString *idColName2,
+ int idScenario)
+{
+ FdoFeatureClass *theClass = NULL;
+ FdoDataPropertyDefinition *dataPropertyDefinition = NULL;
+ FdoGeometricPropertyDefinition *geometricPropertyDefinition = NULL;
+ FdoPropertyDefinitionCollection *dataPropertyDefinitions = NULL;
+ FdoDataPropertyDefinitionCollection *idPropertyDefinitions = NULL;
+
+ try
+ {
+ theClass = FdoFeatureClass::Create(className, className);
+ theClass->SetIsAbstract(false);
+ dataPropertyDefinitions = theClass->GetProperties();
+ idPropertyDefinitions = theClass->GetIdentityProperties();
+
+ switch (idScenario)
+ {
+ case 1: // Single identity property representing the feature id property.
+ dataPropertyDefinition = CreateDataProperty(idColName1, FdoDataType_Int64, 0, false);
+ dataPropertyDefinition->SetIsAutoGenerated(true);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ idPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+ break;
+
+ case 2: // Multiple identity properties; no feature id property included.
+ dataPropertyDefinition = CreateDataProperty(idColName1, FdoDataType_String, 50, false);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ idPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+
+ dataPropertyDefinition = CreateDataProperty(idColName2, FdoDataType_String, 50, false);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ idPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+ break;
+
+ case 3: // Multiple identity properties; feature id property included.
+ dataPropertyDefinition = CreateDataProperty(idColName1, FdoDataType_String, 50, false);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ idPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+
+ dataPropertyDefinition = CreateDataProperty(idColName2, FdoDataType_Int64, 0, false);
+ dataPropertyDefinition->SetIsAutoGenerated(true);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ idPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+ break;
+ }
+
+ dataPropertyDefinition = CreateDataProperty(L"color", FdoDataType_String, 30, false);
+ dataPropertyDefinitions->Add(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+
+ geometricPropertyDefinition = CreateGeometricProperty(L"RDBMS_GEOM");
+ dataPropertyDefinitions->Add(geometricPropertyDefinition);
+ theClass->SetGeometryProperty(geometricPropertyDefinition);
+ FDO_SAFE_RELEASE(geometricPropertyDefinition);
+
+ FDO_SAFE_RELEASE(idPropertyDefinitions);
+ FDO_SAFE_RELEASE(dataPropertyDefinitions);
+
+ theClass->SetBaseClass(NULL);
+ return theClass;
+
+ } // try ...
+
+ catch ( ... )
+ {
+ FDO_SAFE_RELEASE(geometricPropertyDefinition);
+ FDO_SAFE_RELEASE(dataPropertyDefinition);
+ FDO_SAFE_RELEASE(idPropertyDefinitions);
+ FDO_SAFE_RELEASE(dataPropertyDefinitions);
+
+ throw;
+ }
+}
+
+FdoGeometricPropertyDefinition *FdoInsertTest::CreateGeometricProperty (FdoString *propertyName)
+{
+ FdoGeometricPropertyDefinition *geometricPropertyDefinition = NULL;
+ geometricPropertyDefinition = FdoGeometricPropertyDefinition::Create(propertyName, propertyName);
+ geometricPropertyDefinition->SetGeometryTypes(FdoGeometricType_Point |
+ FdoGeometricType_Curve |
+ FdoGeometricType_Surface |
+ FdoGeometricType_Solid );
+ geometricPropertyDefinition->SetHasElevation(false);
+ return geometricPropertyDefinition;
+}
+
+
+
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -36,11 +36,13 @@
CPPUNIT_TEST( insertFlushTest );
//CPPUNIT_TEST( conditionalInsert );
CPPUNIT_TEST( insertAutoGen );
+ //CPPUNIT_TEST( insertLongString );
+ CPPUNIT_TEST( featureReaderTest );
CPPUNIT_TEST_SUITE_END();
public:
FdoInsertTest(void);
- FdoInsertTest(wchar_t *suffix);
+ FdoInsertTest(FdoString *suffix);
virtual ~FdoInsertTest(void);
void setUp ();
@@ -57,6 +59,8 @@
virtual void conditionalInsert();
virtual void DisableFailures(){m_DisableFailures=true;};
virtual void insertAutoGen(); //Insert empty non-feature
+ virtual void insertLongString();
+ virtual void featureReaderTest();
protected:
virtual void set_provider() {};
@@ -66,6 +70,22 @@
static FdoPropertyValue* AddNewProperty( FdoPropertyValueCollection* propertyValues, const wchar_t *name );
void insertBoundaryCleanup( FdoIConnection* connection );
+ // Functions used to setup the test environment for the unit test
+ // featureReaderTest and execute it.
+ FdoIFeatureReader *AddFeature (FdoIConnection *connection, FdoString *className, bool isSpatial, int idScenario);
+
+ FdoDataPropertyDefinition *CreateDataProperty (FdoString *propertyName,
+ FdoDataType dataType,
+ FdoInt32 dataSize,
+ bool isNullable);
+ FdoClass *CreateFdoClass (FdoString *className);
+ FdoFeatureClass *CreateFdoFeatureClass (FdoString *className,
+ FdoString *idColName1,
+ FdoString *idColName2,
+ int idScenario);
+ FdoGeometricPropertyDefinition *CreateGeometricProperty (FdoString *propertyName);
+
+
//Various Max/Min values for various numeric types.
//Used by insertBoundary test.
//Providers can overrides these if they don't support the same ranges of values.
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoSqlCmdTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -18,11 +18,6 @@
#include "Pch.h"
#include "FdoSqlCmdTest.h"
#include "UnitTestUtil.h"
-#include "FdoRdbmsGetSpatialContexts.h"
-#include "FdoRdbmsCreateSpatialContext.h"
-#include "FdoRdbmsDestroySpatialContext.h"
-#include "FdoRdbmsActivateSpatialContext.h"
-#include "FdoRdbmsConnection.h"
#ifdef _DEBUG
#define DBG(X) X
@@ -187,13 +182,13 @@
{
try
{
- FdoPtr<FdoRdbmsGetSpatialContexts> gscCmd;
+ FdoPtr<FdoIGetSpatialContexts> 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 );
+ gscCmd = (FdoIGetSpatialContexts *)mConnection->CreateCommand( FdoCommandType_GetSpatialContexts );
gscCmd->SetActiveOnly(active_only);
@@ -218,16 +213,16 @@
void FdoSqlCmdTest::CreateActivateDestroySC()
{
- FdoPtr<FdoRdbmsCreateSpatialContext> cscCmd;
- FdoPtr<FdoRdbmsDestroySpatialContext> dscCmd;
- FdoPtr<FdoRdbmsActivateSpatialContext> ascCmd;
+ FdoPtr<FdoICreateSpatialContext> cscCmd;
+ FdoPtr<FdoIDestroySpatialContext> dscCmd;
+ FdoPtr<FdoIActivateSpatialContext> ascCmd;
DBG(printf("\n.Creating/Activating/Destroying Spatial Context\n"));
if( mConnection != NULL )
{
try
{
- cscCmd = (FdoRdbmsCreateSpatialContext *)mConnection->CreateCommand( FdoCommandType_CreateSpatialContext );
+ cscCmd = (FdoICreateSpatialContext *)mConnection->CreateCommand( FdoCommandType_CreateSpatialContext );
#pragma message ("ToDo: investigate trancation failure with longer SC names on MySQL.")
cscCmd->SetName(L"SC_X");
@@ -261,7 +256,7 @@
{
FdoPtr<FdoIConnection> mConn = UnitTestUtil::GetConnection(L"", false);
- ascCmd = (FdoRdbmsActivateSpatialContext *)mConn->CreateCommand( FdoCommandType_ActivateSpatialContext );
+ ascCmd = (FdoIActivateSpatialContext *)mConn->CreateCommand( FdoCommandType_ActivateSpatialContext );
ascCmd->SetName(L"SC_X");
@@ -279,7 +274,7 @@
{
FdoPtr<FdoIConnection> mConn = UnitTestUtil::GetConnection(L"", false);
- ascCmd = (FdoRdbmsActivateSpatialContext *)mConn->CreateCommand( FdoCommandType_ActivateSpatialContext );
+ ascCmd = (FdoIActivateSpatialContext *)mConn->CreateCommand( FdoCommandType_ActivateSpatialContext );
ascCmd->SetName(L"SC_X");
@@ -297,7 +292,7 @@
{
FdoPtr<FdoIConnection> mConn = UnitTestUtil::GetConnection(L"", false);
- dscCmd = (FdoRdbmsDestroySpatialContext *)mConn->CreateCommand( FdoCommandType_DestroySpatialContext );
+ dscCmd = (FdoIDestroySpatialContext *)mConn->CreateCommand( FdoCommandType_DestroySpatialContext );
dscCmd->SetName(L"SC_X");
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -357,7 +357,7 @@
prop = FdoUpdateTest::AddNewProperty( properties, L"layer");
if( prop )
prop->SetValue( L"'32001'" );
-#if 0
+#if 1
prop = FdoUpdateTest::AddNewProperty( properties, L"xdata.seq");
if( prop )
prop->SetValue( FdoPtr<FdoDataValue>(FdoDataValue::Create( (int)4 )) );
@@ -419,11 +419,11 @@
dataValue = FdoDataValue::Create(5);
propertyValue = FdoUpdateTest::AddNewProperty( propertyValues, L"Age");
propertyValue->SetValue(dataValue);
-#if 0
+
dataValue = FdoDataValue::Create(43);
propertyValue = FdoUpdateTest::AddNewProperty( propertyValues, L"Object.ObjectWeight");
propertyValue->SetValue(dataValue);
-#endif
+
updateCommand->Execute();
featureTransaction->Commit();
@@ -506,7 +506,6 @@
propertyValue->SetValue(dataValue);
dataValue = FdoDataValue::Create((float)((float)INT_MAX/2.0));
- //dataValue = FdoDataValue::Create(L"Hello");
propertyValue = FdoUpdateTest::AddNewProperty( propertyValues, L"single");
propertyValue->SetValue(dataValue);
@@ -948,7 +947,7 @@
{
connection = UnitTestUtil::GetConnection(mSuffix, false);
UnitTestUtil::CreateLandSchema(connection);
- //UnitTestUtil::CreateNonUniqueSchema(connection);
+ UnitTestUtil::CreateNonUniqueSchema(connection);
featureTransaction = connection->BeginTransaction();
@@ -1325,6 +1324,9 @@
CPPUNIT_ASSERT( expectedZ == pos->GetZ() );
}
+void FdoUpdateTest::CheckSpatialContexts(FdoPtr<FdoIConnection> connection, int expected)
+{
+}
void FdoUpdateTest::ConditionalUpdate()
{
@@ -1337,7 +1339,7 @@
try
{
- connection = UnitTestUtil::GetConnection(L"LT", true, Connection_WithDatastore, 1, true);
+ connection = UnitTestUtil::GetConnection(L"LT", true, true, Connection_WithDatastore, 1, true);
// Generate the necessary long transaction names.
@@ -1804,6 +1806,9 @@
CreateExternalTable( owner, L"TABLE_NOID_GEOM", false, m_hasGeom, false );
CreateExternalTable( owner, table_noid_nogeom, false, false, false );
+ // Special tables for special testing.
+ CreateExternalTable( owner, L"TABLE_ID_GEOM_LL", true, providerName != L"SqlServer", false );
+ CreateExternalTable( owner, L"TABLE_ID_GEOM_XYZM", true, providerName != L"SqlServer", false );
owner->Commit();
@@ -1813,6 +1818,7 @@
NoMetaSuffix()
);
+ UpdSpatialMetadata( connection );
CreateExternalData( connection, phMgr, table_id_geom, m_hasGeom, m_hasAssoc );
#ifdef RDBI_DEF_SSQL
@@ -1925,7 +1931,7 @@
table->AddPkeyCol( fkColumn->GetName() );
if ( hasGeom )
- column = table->CreateColumnGeom( phMgr->GetDcColumnName(L"GEOMETRY"), (FdoSmPhScInfo*) NULL, true, false );
+ column = table->CreateColumnGeom( phMgr->GetDcColumnName(L"GEOMETRY"), CreateScInfo(tableName), true, false );
column = table->CreateColumnChar( phMgr->GetDcColumnName(ValueColName()), true, 20 );
@@ -1962,13 +1968,59 @@
if ( hasGeom ) {
columnName = phMgr->GetDcColumnName(L"GEOMETRY");
- column = view->CreateColumnGeom( columnName, (FdoSmPhScInfo*) NULL, true, false, false, columnName );
+ column = view->CreateColumnGeom( columnName, CreateScInfo(tableName), true, false, false, columnName );
}
columnName = phMgr->GetDcColumnName(ValueColName());
column = view->CreateColumnChar( columnName, true, 20, columnName );
}
+FdoPtr<FdoSmPhScInfo> FdoUpdateTest::CreateScInfo( FdoStringP objectName )
+{
+ FdoSmPhScInfo *scinfo = NULL;
+
+ // The tables need to have the same SRID since this test is copying from one another
+ scinfo = FdoSmPhScInfo::Create();
+
+ // The tables need to have the same SRID since this test is copying from one another
+ scinfo->mSrid = 81989; // British National Grid
+ scinfo->mCoordSysName = L"";
+
+ FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
+ FdoPtr<FdoIEnvelope> env;
+
+ if ( objectName == L"TABLE_ID_GEOM" )
+ env = gf->CreateEnvelopeXY( -1001, -1002, 1001, 1002 );
+ else if ( objectName == L"TABLE_ID_GEOM_LL" )
+ {
+ env = gf->CreateEnvelopeXY( -180, -90, 180, 90 );
+ scinfo->mSrid = 524288; // Longitude / Latitude (NAD 83) Datum 33
+ }
+ else if ( objectName == L"TABLE_ID_GEOM_XYZM" )
+ {
+ env = gf->CreateEnvelopeXYZ( -3001, -3002, -3003, 3001, 3002, 3003);
+ }
+ else
+ env = gf->CreateEnvelopeXY( -2001, -2002, 2001, 2002 );
+
+ FdoPtr<FdoIGeometry> geom = gf->CreateGeometry(env);
+ scinfo->mExtent = gf->GetFgf(geom);
+ scinfo->mXYTolerance = 0.0333;
+ scinfo->mZTolerance = 0.0111;
+
+ return scinfo;
+}
+
+bool FdoUpdateTest::GetHasElevation( FdoStringP objectName )
+{
+ bool hasElevation = true;
+
+ if ( objectName == L"TABLE_ID_GEOM_LL" )
+ hasElevation = false;
+
+ return hasElevation;
+}
+
void FdoUpdateTest::CreateExternalData( FdoPtr<FdoIConnection> connection, FdoSmPhMgrP phMgr, FdoStringP tableName, bool hasGeom, bool hasAssoc )
{
@@ -2153,6 +2205,10 @@
deleteCommand = NULL;
}
+void FdoUpdateTest::UpdSpatialMetadata( FdoPtr<FdoIConnection> connection )
+{
+}
+
void FdoUpdateTest::SelectNoMetaAll( FdoPtr<FdoIConnection> connection, FdoSmPhMgrP phMgr, FdoStringP tableName, bool hasGeom, bool hasAssoc )
{
FdoPtr<FdoISelect> selectCommand = (FdoISelect *) connection->CreateCommand(FdoCommandType_Select);
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -60,7 +60,10 @@
void CreateExternalTable( FdoSmPhOwnerP owner, FdoStringP tableName, bool hasKey, bool hasGeom, bool hasAssoc );
void CreateExternalView( FdoSmPhOwnerP owner, FdoStringP viewName, FdoStringP tableName, bool hasKey, bool hasGeom, bool hasAssoc );
+ FdoPtr<FdoSmPhScInfo> CreateScInfo( FdoStringP objectName );
+ bool GetHasElevation( FdoStringP objectName );
void CreateExternalData( FdoPtr<FdoIConnection> connection, FdoSmPhMgrP phMgr, FdoStringP tableName, bool hasGeom, bool hasAssoc );
+ virtual void UpdSpatialMetadata( FdoPtr<FdoIConnection> connection );
void SelectNoMetaAll( FdoPtr<FdoIConnection> connection, FdoSmPhMgrP phMgr, FdoStringP tableName, bool hasGeom, bool hasAssoc );
void SelectNoMetaFilter( FdoPtr<FdoIConnection> connection, FdoSmPhMgrP phMgr, FdoStringP tableName, bool hasGeom, bool hasAssoc );
void SelectNoMetaProps( FdoPtr<FdoIConnection> connection, FdoSmPhMgrP phMgr, FdoStringP tableName, bool hasGeom );
@@ -75,6 +78,7 @@
bool hasAssoc
);
void CheckGeometry(FdoPtr<FdoIFeatureReader> rdr, FdoString* propName, double expectedX, double expectedY, double expectedZ);
+ virtual void CheckSpatialContexts(FdoPtr<FdoIConnection> connection, int expected);
virtual FdoString* NoMetaSuffix();
virtual FdoString* MultiIdSuffix();
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/Makefile.am
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/Makefile.am 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/Makefile.am 2007-03-15 12:39:06 UTC (rev 794)
@@ -52,6 +52,7 @@
GeometryTests.cpp \
MessageTest.cpp \
SchemaMgrTests.cpp \
+SchemaOverrideUtil.cpp \
SelectTests.cpp \
XmlFormatter.cpp \
UnitTestUtil.cpp
@@ -85,6 +86,7 @@
GeometryTests.h \
MessageTest.h \
SchemaMgrTests.h \
+SchemaOverrideUtil.h \
SelectTests.h \
StringPropertiesDictionary.h \
UnitTestUtil.h \
Added: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.cpp (rev 0)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -0,0 +1,32 @@
+ //
+ // Copyright (C) 2004-2006 Autodesk, Inc.
+ //
+ // This library is free software; you can redistribute it and/or
+ // modify it under the terms of version 2.1 of the GNU Lesser
+ // General Public License as published by the Free Software Foundation.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ // Lesser General Public License for more details.
+ //
+ // You should have received a copy of the GNU Lesser General Public
+ // License along with this library; if not, write to the Free Software
+ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#include "Pch.h"
+#include "SchemaOverrideUtil.h"
+
+SchemaOverrideUtil::SchemaOverrideUtil(void)
+{
+}
+
+SchemaOverrideUtil::~SchemaOverrideUtil(void)
+{
+}
+
+void SchemaOverrideUtil::Dispose()
+{
+ delete this;
+}
+
Added: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.h (rev 0)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaOverrideUtil.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -0,0 +1,63 @@
+ //
+ // Copyright (C) 2004-2006 Autodesk, Inc.
+ //
+ // This library is free software; you can redistribute it and/or
+ // modify it under the terms of version 2.1 of the GNU Lesser
+ // General Public License as published by the Free Software Foundation.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ // Lesser General Public License for more details.
+ //
+ // You should have received a copy of the GNU Lesser General Public
+ // License along with this library; if not, write to the Free Software
+ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#ifndef CPP_UNIT_SCHEMAOVERRIDEUTIL_H
+#define CPP_UNIT_SCHEMAOVERRIDEUTIL_H
+
+#include <Rdbms/Override/RdbmsOvPhysicalSchemaMapping.h>
+
+/*
+ * A test case for ApplySchemaCommand.
+ *
+ * Loads some schemas into a database.
+ */
+
+class SchemaOverrideUtil : public FdoIDisposable
+{
+public:
+ SchemaOverrideUtil(void);
+ virtual ~SchemaOverrideUtil(void);
+
+
+
+ virtual FdoRdbmsOvClassDefinition* CreateOvClassDefinition(FdoString *name = NULL) { return NULL; };
+ virtual void ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass) {};
+ virtual FdoRdbmsOvTable* CreateOvTable(FdoString* name) { return NULL; };
+ virtual FdoRdbmsOvColumn* CreateOvColumn(FdoString* name) { return NULL; };
+ virtual FdoRdbmsOvGeometricColumn* CreateOvGeometricColumn(FdoString* name) { return NULL; };
+ virtual FdoRdbmsOvDataPropertyDefinition* CreateOvDataPropertyDefinition(FdoString *name) { return NULL; };
+ virtual FdoRdbmsOvGeometricPropertyDefinition* CreateOvGeometricPropertyDefinition(FdoString *name) { return NULL; };
+ virtual void PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp) {};
+ virtual void ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable) {};
+ virtual void TableOvSetTablespace(FdoRdbmsOvTable* pTable, FdoString *tablespace) {};
+ virtual void DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn) {};
+ virtual void GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn) {};
+ virtual void ColumnOvSetSequence(FdoRdbmsOvColumn* pColumn, FdoString *sequence) {};
+ virtual FdoRdbmsOvObjectPropertyDefinition* CreateOvObjectPropertyDefinition(FdoString *name) { return NULL; };
+ virtual FdoRdbmsOvPropertyMappingSingle* CreateOvPropertyMappingSingle() { return NULL; };
+ virtual FdoRdbmsOvPropertyMappingConcrete* CreateOvPropertyMappingConcrete() { return NULL; };
+ virtual void ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping) {};
+ virtual void PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass) {};
+ virtual void SchemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner) {};
+
+protected:
+ virtual void Dispose();
+
+};
+
+typedef FdoPtr<SchemaOverrideUtil> SchemaOverrideUtilP;
+
+#endif // CPP_UNIT_FDOAPPLYSCHEMATEST_H
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -163,13 +163,16 @@
void UnitTestUtil::CreateAcadSchema( FdoIConnection* connection, bool useBaseMapping )
{
FdoIApplySchema* pCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
-// FdoPtr<FdoOracleOvPhysicalSchemaMapping>pOverrides;
-// FdoPtr<FdoOracleOvClassDefinition>pOvClass;
-// if( useBaseMapping )
-// {
-// pOverrides = (FdoOracleOvPhysicalSchemaMapping*) connection->CreateSchemaMapping();
-// pCmd->SetPhysicalMapping( pOverrides );
-// }
+ FdoPtr<FdoRdbmsOvPhysicalSchemaMapping>pOverrides;
+ FdoPtr<FdoRdbmsOvClassDefinition>pOvClass;
+ SchemaOverrideUtilP overrideUtil = NewSchemaOverrideUtil();
+
+ if( useBaseMapping )
+ {
+ pOverrides = (FdoRdbmsOvPhysicalSchemaMapping*) connection->CreateSchemaMapping();
+ pOverrides->SetTableMapping( FdoSmOvTableMappingType_BaseTable );
+ pCmd->SetPhysicalMapping( pOverrides );
+ }
FdoPtr<FdoFeatureSchemaCollection> pSchemas = FdoFeatureSchemaCollection::Create(NULL);
FdoFeatureSchema* pSchema = FdoFeatureSchema::Create( L"Acad", L"AutoCAD schema" );
@@ -231,18 +234,18 @@
testClass->GetProperties()->Add( pObjPropData );
FDO_SAFE_RELEASE(pObjPropData);
- //if( useBaseMapping )
- //{
- // // Object Property overrides
- // pOvClass = FdoOracleOvClassDefinition::Create( L"testClass" );
- // pOvClass->SetTableMapping( FdoSmOvTableMappingType_BaseTable );
- // FdoOracleOvClassesP(pOverrides->GetClasses())->Add(pOvClass);
- // FdoOracleOvObjectPropertyP pObProp = FdoOracleOvObjectPropertyDefinition::Create( L"Object" );
- // FdoOracleOvPropertiesP(pOvClass->GetProperties())->Add(pObProp);
- // FdoOracleOvPropertyMappingSingleP mapping = FdoOracleOvPropertyMappingSingle::Create();
- // pObProp->SetMappingDefinition(mapping);
- // mapping->SetPrefix( L"OvTest" );
- //}
+ if( useBaseMapping && overrideUtil )
+ {
+ // Object Property overrides
+ pOvClass = overrideUtil->CreateOvClassDefinition( L"testClass" );
+ pOvClass->SetTableMapping( FdoSmOvTableMappingType_BaseTable );
+ overrideUtil->ClassesOvAdd(pOverrides, pOvClass);
+ FdoRdbmsOvObjectPropertyP pObProp = overrideUtil->CreateOvObjectPropertyDefinition( L"Object" );
+ overrideUtil->PropertiesOvAdd(pOvClass, pObProp);
+ FdoRdbmsOvPropertyMappingSingleP mapping = overrideUtil->CreateOvPropertyMappingSingle();
+ overrideUtil->ObjectPropertyOvSetMappingDefinition(pObProp, mapping);
+ mapping->SetPrefix( L"OvTest" );
+ }
FdoPtr<FdoObjectPropertyDefinition>pObjPropData2 = FdoObjectPropertyDefinition::Create( L"Object2", L"object property" );
pObjPropData2->SetClass( pObjectClass2 );
@@ -309,16 +312,16 @@
pObjPropData2->SetObjectType( FdoObjectType_Value );
pXData->GetProperties()->Add( pObjPropData2 );
- //if( useBaseMapping )
- //{
- // pOvClass = FdoOracleOvClassDefinition::Create( L"AcXData" );
- // FdoOracleOvClassesP(pOverrides->GetClasses())->Add(pOvClass);
- // FdoOracleOvObjectPropertyP pObProp = FdoOracleOvObjectPropertyDefinition::Create( L"AcXObj" );
- // FdoOracleOvPropertiesP(pOvClass->GetProperties())->Add(pObProp);
- // FdoOracleOvPropertyMappingSingleP mapping = FdoOracleOvPropertyMappingSingle::Create();
- // pObProp->SetMappingDefinition(mapping);
- // mapping->SetPrefix( L"OvTest2" );
- //}
+ if( useBaseMapping && overrideUtil )
+ {
+ pOvClass = overrideUtil->CreateOvClassDefinition( L"AcXData" );
+ overrideUtil->ClassesOvAdd(pOverrides, pOvClass);
+ FdoRdbmsOvObjectPropertyP pObProp = overrideUtil->CreateOvObjectPropertyDefinition( L"AcXObj" );
+ overrideUtil->PropertiesOvAdd(pOvClass, pObProp);
+ FdoRdbmsOvPropertyMappingSingleP mapping = overrideUtil->CreateOvPropertyMappingSingle();
+ overrideUtil->ObjectPropertyOvSetMappingDefinition(pObProp, mapping);
+ mapping->SetPrefix( L"OvTest2" );
+ }
pSchema->GetClasses()->Add( pXData );
FdoClass* pXData2 = FdoClass::Create( L"AcXData2", L"Xdata2" );
@@ -432,6 +435,7 @@
FdoObjectPropertyDefinition* pObjProp = FdoObjectPropertyDefinition::Create( L"xdata", L"xdata" );
pObjProp->SetClass( pXData );
pObjProp->SetObjectType( FdoObjectType_Value );
+ //pObjProp->SetIdentityProperty( pXDataSeq );
pEntClass->GetProperties()->Add( pObjProp );
FDO_SAFE_RELEASE(pProp);
@@ -491,7 +495,8 @@
{
// Version must be incremented each time the following Land schema is updated.
// This forces a re-create of the Land Schema in existing datastores.
- static wchar_t* currVersion = L"1.6";
+ static wchar_t* currVersion = L"1.7";
+ FdoPtr<FdoISchemaCapabilities> schemaCap = connection->GetSchemaCapabilities();
FdoPtr<FdoIDescribeSchema> pDescCmd = (FdoIDescribeSchema*) connection->CreateCommand(FdoCommandType_DescribeSchema);
@@ -502,7 +507,7 @@
// If it does, check if it has the current version. The version is kept in
// the Schema Attribute dictionary.
-/*
+
if ( pSchema ) {
if ( (!FdoSADP(pSchema->GetAttributes())->ContainsAttribute(L"version")) ||
(wcscmp(FdoSADP(pSchema->GetAttributes())->GetAttributeValue(L"version"), currVersion) != 0) ) {
@@ -511,13 +516,13 @@
// First, delete any objects, since these will prevent schema destruction.
FdoPtr<FdoIDelete> deleteCommand = (FdoIDelete *) connection->CreateCommand(FdoCommandType_Delete);
- deleteCommand->SetFeatureClassName(L"Ind\x00fcstri\x00e4l P\x00e4rcel");
+ deleteCommand->SetFeatureClassName(L"L\x00e4nd:Ind\x00fcstri\x00e4l P\x00e4rcel");
deleteCommand->Execute();
- deleteCommand->SetFeatureClassName(L"Municipality");
+ deleteCommand->SetFeatureClassName(L"L\x00e4nd:Municipality");
deleteCommand->Execute();
- deleteCommand->SetFeatureClassName(L"Parcel");
+ deleteCommand->SetFeatureClassName(L"L\x00e4nd:Parcel");
deleteCommand->Execute();
FdoPtr<FdoIDestroySchema> pCmd = (FdoIDestroySchema*) connection->CreateCommand(FdoCommandType_DestroySchema);
@@ -526,7 +531,7 @@
pSchema = NULL;
}
}
-*/
+
if ( !pSchema )
{
FdoPtr<FdoIApplySchema> pCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
@@ -565,6 +570,22 @@
FdoPropertiesP(pParcelClass->GetProperties())->Add( pProp );
FdoDataPropertiesP(pParcelClass->GetIdentityProperties())->Add( pProp );
+/*
+ if ( schemaCap->SupportsExclusiveValueRangeConstraints() && schemaCap->SupportsInclusiveValueRangeConstraints())
+ {
+ GisPtr<FdoPropertyValueConstraintRange> newRangeConstr1 = FdoPropertyValueConstraintRange::Create();
+ newRangeConstr1->SetMinInclusive(true);
+
+ GisPtr<FdoDataValue> val1 = FdoDataValue::Create( L"A" );
+ newRangeConstr1->SetMinValue( val1 );
+
+ newRangeConstr1->SetMaxInclusive(true);
+ GisPtr<FdoDataValue> val2 = FdoDataValue::Create( L"z" );
+ newRangeConstr1->SetMaxValue( val2 );
+ pProp->SetValueConstraint(newRangeConstr1);
+ }
+*/
+
pProp = FdoDataPropertyDefinition::Create( L"PIN", L"parcel id" );
pProp->SetDataType( FdoDataType_String );
pProp->SetLength(15);
@@ -579,6 +600,20 @@
pProp->SetScale( 0 );
FdoPropertiesP(pParcelClass->GetProperties())->Add( pProp );
+ if ( schemaCap->SupportsExclusiveValueRangeConstraints() && schemaCap->SupportsInclusiveValueRangeConstraints())
+ {
+ FdoPtr<FdoPropertyValueConstraintRange> newRangeConstr1 = FdoPropertyValueConstraintRange::Create();
+ newRangeConstr1->SetMinInclusive(true);
+
+ FdoPtr<FdoDataValue> val1 = FdoDataValue::Create( (double) 0, FdoDataType_Decimal );
+ newRangeConstr1->SetMinValue( val1 );
+
+ newRangeConstr1->SetMaxInclusive(true);
+ FdoPtr<FdoDataValue> val2 = FdoDataValue::Create( 100000000, FdoDataType_Decimal );
+ newRangeConstr1->SetMaxValue( val2 );
+ pProp->SetValueConstraint(newRangeConstr1);
+ }
+
pProp = FdoDataPropertyDefinition::Create( L"AUTOGEN1", L"1st autogenerated property" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(true);
@@ -604,6 +639,45 @@
pGeomProp->SetHasElevation( true );
FdoClassesP(pSchema->GetClasses())->Add( pParcelClass );
+ FdoPtr<FdoFeatureClass> pParcelAClass = FdoFeatureClass::Create( L"Parcel_A", L"land parcel" );
+ pParcelAClass->SetIsAbstract(false);
+
+ pProp = FdoDataPropertyDefinition::Create( L"Name", L"" );
+ pProp->SetDataType( FdoDataType_String );
+ pProp->SetLength(20);
+ pProp->SetNullable(false);
+ FdoPropertiesP(pParcelAClass->GetProperties())->Add( pProp );
+
+ pProp = FdoDataPropertyDefinition::Create( L"PIN", L"parcel id" );
+ pProp->SetDataType( FdoDataType_String );
+ pProp->SetLength(15);
+ pProp->SetNullable(false);
+ FdoPropertiesP(pParcelAClass->GetProperties())->Add( pProp );
+ FdoDataPropertiesP(pParcelAClass->GetIdentityProperties())->Add( pProp );
+
+ pProp = FdoDataPropertyDefinition::Create( L"Value", L"" );
+ pProp->SetDataType( FdoDataType_Decimal );
+ pProp->SetNullable(true);
+ pProp->SetPrecision( 8 );
+ pProp->SetScale( 0 );
+ FdoPropertiesP(pParcelAClass->GetProperties())->Add( pProp );
+
+ if ( schemaCap->SupportsExclusiveValueRangeConstraints() && schemaCap->SupportsInclusiveValueRangeConstraints())
+ {
+ FdoPtr<FdoPropertyValueConstraintRange> newRangeConstr1 = FdoPropertyValueConstraintRange::Create();
+ newRangeConstr1->SetMinInclusive(true);
+
+ FdoPtr<FdoDataValue> val1 = FdoDataValue::Create( (double) 0, FdoDataType_Decimal );
+ newRangeConstr1->SetMinValue( val1 );
+
+ newRangeConstr1->SetMaxInclusive(true);
+ FdoPtr<FdoDataValue> val2 = FdoDataValue::Create( 100000000, FdoDataType_Decimal );
+ newRangeConstr1->SetMaxValue( val2 );
+ pProp->SetValueConstraint(newRangeConstr1);
+ }
+
+ FdoClassesP(pSchema->GetClasses())->Add( pParcelAClass );
+
FdoPtr<FdoFeatureClass> pClass = FdoFeatureClass::Create( L"Ind\x00fcstri\x00e4l P\x00e4rcel", L"" );
pClass->SetIsAbstract(false);
pClass->SetBaseClass( pParcelClass );
@@ -632,6 +706,20 @@
pProp->SetNullable(false);
FdoPropertiesP(pCityClass->GetProperties())->Add( pProp );
+ if ( schemaCap->SupportsExclusiveValueRangeConstraints() && schemaCap->SupportsInclusiveValueRangeConstraints())
+ {
+ FdoPtr<FdoPropertyValueConstraintRange> newRangeConstr1 = FdoPropertyValueConstraintRange::Create();
+ newRangeConstr1->SetMinInclusive(true);
+
+ FdoPtr<FdoDataValue> val1 = FdoDataValue::Create( 0 );
+ newRangeConstr1->SetMinValue( val1 );
+
+ newRangeConstr1->SetMaxInclusive(true);
+ FdoPtr<FdoDataValue> val2 = FdoDataValue::Create( 100000000 );
+ newRangeConstr1->SetMaxValue( val2 );
+ pProp->SetValueConstraint(newRangeConstr1);
+ }
+
pObjProp = FdoObjectPropertyDefinition::Create( L"mayor", L"" );
pObjProp->SetObjectType( FdoObjectType_Value );
pObjProp->SetClass( pPersonClass );
@@ -645,6 +733,68 @@
FdoClassesP(pSchema->GetClasses())->Add( pCityClass );
+ FdoFeatureClassP pZoningClass = FdoFeatureClass::Create( L"Zoning", L"land use zone" );
+ pZoningClass->SetIsAbstract(false);
+
+ pProp = FdoDataPropertyDefinition::Create( L"ByLaw", L"" );
+ pProp->SetDataType( FdoDataType_String );
+ pProp->SetLength(20);
+ pProp->SetNullable(false);
+ FdoPropertiesP(pZoningClass->GetProperties())->Add( pProp );
+ FdoDataPropertiesP(pZoningClass->GetIdentityProperties())->Add( pProp );
+
+ pProp = FdoDataPropertyDefinition::Create( L"ZoningType", L"" );
+ pProp->SetDataType( FdoDataType_Int32 );
+ pProp->SetNullable(false);
+ FdoPropertiesP(pZoningClass->GetProperties())->Add( pProp );
+
+ if ( schemaCap->SupportsExclusiveValueRangeConstraints() && schemaCap->SupportsInclusiveValueRangeConstraints())
+ {
+ FdoPtr<FdoPropertyValueConstraintRange> newRangeConstr1 = FdoPropertyValueConstraintRange::Create();
+ newRangeConstr1->SetMinInclusive(true);
+
+ FdoPtr<FdoDataValue> val1 = FdoDataValue::Create( 1 );
+ newRangeConstr1->SetMinValue( val1 );
+
+ newRangeConstr1->SetMaxInclusive(true);
+ FdoPtr<FdoDataValue> val2 = FdoDataValue::Create( 20 );
+ newRangeConstr1->SetMaxValue( val2 );
+ pProp->SetValueConstraint(newRangeConstr1);
+ }
+
+ FdoClassesP(pSchema->GetClasses())->Add( pZoningClass );
+
+ pZoningClass = FdoFeatureClass::Create( L"Zoning_A", L"land use zone" );
+ pZoningClass->SetIsAbstract(false);
+
+ pProp = FdoDataPropertyDefinition::Create( L"ByLaw", L"" );
+ pProp->SetDataType( FdoDataType_String );
+ pProp->SetLength(20);
+ pProp->SetNullable(false);
+ FdoPropertiesP(pZoningClass->GetProperties())->Add( pProp );
+ FdoDataPropertiesP(pZoningClass->GetIdentityProperties())->Add( pProp );
+
+ pProp = FdoDataPropertyDefinition::Create( L"ZoningType", L"" );
+ pProp->SetDataType( FdoDataType_Int32 );
+ pProp->SetNullable(false);
+ FdoPropertiesP(pZoningClass->GetProperties())->Add( pProp );
+
+ if ( schemaCap->SupportsExclusiveValueRangeConstraints() && schemaCap->SupportsInclusiveValueRangeConstraints())
+ {
+ FdoPtr<FdoPropertyValueConstraintRange> newRangeConstr1 = FdoPropertyValueConstraintRange::Create();
+ newRangeConstr1->SetMinInclusive(true);
+
+ FdoPtr<FdoDataValue> val1 = FdoDataValue::Create( 21 );
+ newRangeConstr1->SetMinValue( val1 );
+
+ newRangeConstr1->SetMaxInclusive(true);
+ FdoPtr<FdoDataValue> val2 = FdoDataValue::Create( 40 );
+ newRangeConstr1->SetMaxValue( val2 );
+ pProp->SetValueConstraint(newRangeConstr1);
+ }
+
+ FdoClassesP(pSchema->GetClasses())->Add( pZoningClass );
+
pCmd->SetFeatureSchema( pSchema );
pCmd->Execute();
}
@@ -655,7 +805,7 @@
{
// Version must be incremented each time the following Land schema is updated.
// This forces a re-create of the NonUnique Schema in existing datastores.
- static wchar_t* currVersion = L"1.2";
+ static wchar_t* currVersion = L"1.3";
FdoPtr<FdoIDescribeSchema> pDescCmd = (FdoIDescribeSchema*) connection->CreateCommand(FdoCommandType_DescribeSchema);
@@ -923,8 +1073,8 @@
// Optimization: This has been already checked in GetConnection(). Make sure the caller
// checks the existence explictly.
- //bool bExists = DatastoreExists(suffix);
- bool bExists = false;
+ bool bExists = DatastoreExists(suffix);
+ //bool bExists = false;
if (bExists == false)
{
@@ -936,7 +1086,6 @@
connection->SetConnectionString ( connectString);
connection->Open ();
-// connection->GetDbiConnection()->dbi_set_lt_method(local_lt_method);
if( addSchema )
{
try
@@ -1308,37 +1457,45 @@
return(found);
}
-FdoIConnection* UnitTestUtil::GetConnection(FdoString *suffix, bool bCreate, StringConnTypeRequest pTypeReq, int lt_method, bool lt_method_fixed)
+FdoIConnection* UnitTestUtil::GetConnection(FdoString *suffix, bool bCreate, bool bRecreateData, StringConnTypeRequest pTypeReq, int lt_method, bool lt_method_fixed)
{
FdoIConnection* connection = GetProviderConnectionObject();
try {
- if (bCreate)
+ bool bCreated = false;
+ if (bCreate)
{
- bool bExists = DatastoreExists(suffix);
+ bool bExists = UnitTestUtil::DatastoreExists(suffix);
if (!bExists)
{
UnitTestUtil::CreateDB(true, false, suffix, lt_method, lt_method_fixed);
-
- FdoInsertTest *insert = UnitTestUtil::InfoUtilConnection->GetInsertTest();
- insert->setUp();
- insert->insert();
- delete insert;
-/* TODO
- insert = new FdoInsertTest();
- insert->setUp();
- insert->insert2();
- delete insert;
-*/
+ bCreated = true;
}
}
- wchar_t *connectionString = UnitTestUtil::GetConnectionString(pTypeReq, suffix);
+ wchar_t *connectionString = UnitTestUtil::GetConnectionString(Connection_WithDatastore, suffix);
FdoConnectionState state = connection->GetConnectionState();
- connection->SetConnectionString(connectionString);
+ connection->SetConnectionString(connectionString);
connection->Open();
+ if ( (!bCreated) && bRecreateData ) {
+ TestCommonMiscUtil::DeleteObjects( connection, L"Acad", L"AcDb3dPolyline", NULL );
+ TestCommonMiscUtil::DeleteObjects( connection, L"L\x00e4nd", L"Parcel", NULL );
+ TestCommonMiscUtil::DeleteObjects( connection, L"Acad", L"testClass", NULL );
+ }
+
+ if ( bCreated || bRecreateData ) {
+ FdoInsertTest *insert = new FdoInsertTest(suffix);
+
+ insert->setUp();
+ insert->insert();
+ delete insert;
+ insert = new FdoInsertTest(suffix);
+ insert->setUp();
+ insert->insert2();
+ delete insert;
+ }
}
catch ( FdoException* e )
{
@@ -1362,6 +1519,11 @@
return UnitTestUtil::InfoUtilConnection->NewStaticConnection();
}
+SchemaOverrideUtilP UnitTestUtil::NewSchemaOverrideUtil()
+{
+ return UnitTestUtil::InfoUtilConnection->NewSchemaOverrideUtil();
+}
+
bool UnitTestUtil::fuzzyEqual (const double d1, const double d2)
{
if ((d1==0.0) || (d2==0.0))
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/UnitTestUtil.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -21,6 +21,7 @@
// Various utility functions to help with unit testing.
#include <Sm/SchemaManager.h>
+#include "SchemaOverrideUtil.h"
enum StringConnTypeRequest {
Connection_WithDatastore,
@@ -147,8 +148,9 @@
// false - otherwise.
static bool DatastoreExists(FdoString *suffix = L"");
- static FdoIConnection* GetConnection(FdoString *suffix = L"", bool bCreate = false, StringConnTypeRequest pTypeReq = Connection_WithDatastore, int lt_method = 0, bool lt_method_fixed = false );
+ static FdoIConnection* GetConnection(FdoString *suffix = L"", bool bCreate = false, bool bRecreateData = false, StringConnTypeRequest pTypeReq = Connection_WithDatastore, int lt_method = 0, bool lt_method_fixed = false );
static StaticConnection* NewStaticConnection();
+ static SchemaOverrideUtilP NewSchemaOverrideUtil();
// compares two doubles for *approximate* equality:
static bool fuzzyEqual (const double d1, const double d2);
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/Makefile.am
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/Makefile.am 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/Makefile.am 2007-03-15 12:39:06 UTC (rev 794)
@@ -50,6 +50,7 @@
MySqlFdoUpdateTest.cpp \
MySqlGeometryTests.cpp \
MySqlSchemaMgrTests.cpp \
+MySqlSchemaOverrideUtil.cpp \
MySqlSelectTests.cpp
noinst_HEADERS = $(libMySqlUnitTests_la_SOURCES) \
@@ -81,6 +82,7 @@
MySqlFdoUpdateTest.h \
MySqlGeometryTests.h \
MySqlSchemaMgrTests.h \
+MySqlSchemaOverrideUtil.h \
MySqlSelectTests.h
INCLUDES = \
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -18,6 +18,7 @@
#include "Pch.h"
#include "MySqlConnectionUtil.h"
+#include "MySqlSchemaOverrideUtil.h"
#include "UnitTestUtil.h"
#include "MySqlFdoInsertTest.h"
#include "../../MySQL/SchemaMgr/SchemaManager.h"
@@ -200,6 +201,11 @@
return new MySqlStaticConnection();
}
+SchemaOverrideUtilP MySqlConnectionUtil::NewSchemaOverrideUtil()
+{
+ return new MySqlSchemaOverrideUtil();
+}
+
FdoInsertTest* MySqlConnectionUtil::GetInsertTest ()
{
return new MySqlFdoInsertTest();
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlConnectionUtil.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -44,6 +44,7 @@
virtual void SetProvider( const char *providerName );
virtual StaticConnection* NewStaticConnection ();
+ virtual SchemaOverrideUtilP NewSchemaOverrideUtil();
virtual FdoInsertTest* GetInsertTest ();
virtual FdoStringP GetOutputFileName (FdoString* pBaseFileName);
};
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -25,7 +25,12 @@
void MySqlDescribeSchemaTest::set_provider()
{
- mInputSchema = mSchema;
mInputData = mData;
UnitTestUtil::SetProvider( "MySql" );
}
+
+FdoInt32 MySqlDescribeSchemaTest::GetLockTypeCount()
+{
+ return 0;
+}
+
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDescribeSchemaTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -27,6 +27,7 @@
CPPUNIT_TEST_SUITE_END ();
void set_provider();
+ virtual FdoInt32 GetLockTypeCount();
};
#endif // MYSQL_DESCRIBESCHEMA_H
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -64,11 +64,6 @@
}
}
-void MySqlFdoApplySchemaTest::ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass)
-{
- FdoMySQLOvClassesP(((FdoMySQLOvPhysicalSchemaMapping*)pSchema)->GetClasses())->Add((FdoMySQLOvClassDefinition*)pClass);
-}
-
FdoRdbmsOvTable* MySqlFdoApplySchemaTest::CreateOvTable(FdoString* name)
{
FdoMySQLOvTable* table = FdoMySQLOvTable::Create(name);
@@ -103,82 +98,6 @@
return table;
}
-FdoRdbmsOvColumn* MySqlFdoApplySchemaTest::CreateOvColumn(FdoString* name)
-{
- return FdoMySQLOvColumn::Create(name);
-}
-
-FdoRdbmsOvGeometricColumn* MySqlFdoApplySchemaTest::CreateOvGeometricColumn(FdoString* name)
-{
- return FdoMySQLOvGeometricColumn::Create(name);
-}
-
-FdoRdbmsOvDataPropertyDefinition* MySqlFdoApplySchemaTest::CreateOvDataPropertyDefinition(FdoString *name)
-{
- return FdoMySQLOvDataPropertyDefinition::Create(name);
-}
-
-FdoRdbmsOvGeometricPropertyDefinition* MySqlFdoApplySchemaTest::CreateOvGeometricPropertyDefinition(FdoString *name)
-{
- return FdoMySQLOvGeometricPropertyDefinition::Create(name);
-}
-
-void MySqlFdoApplySchemaTest::PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp)
-{
- FdoMySQLOvPropertiesP(((FdoMySQLOvClassDefinition*)pClass)->GetProperties())->Add(dynamic_cast<FdoMySQLOvPropertyDefinition*>(pProp));
-}
-
-void MySqlFdoApplySchemaTest::ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable)
-{
- ((FdoMySQLOvClassDefinition*)pClass)->SetTable((FdoMySQLOvTable*)pTable);
-}
-
-void MySqlFdoApplySchemaTest::TableOvSetTablespace(FdoRdbmsOvTable* pTable, FdoString *tablespace)
-{
- // do nothing (MySQL doesn't support tablespace per se)
-}
-
-void MySqlFdoApplySchemaTest::DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn)
-{
- ((FdoMySQLOvDataPropertyDefinition*)pDataProp)->SetColumn((FdoMySQLOvColumn*)pDataColumn);
-}
-
-void MySqlFdoApplySchemaTest::GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn)
-{
- ((FdoMySQLOvGeometricPropertyDefinition*)pGeomProp)->SetColumn((FdoMySQLOvGeometricColumn*)pGeometricColumn);
-}
-
-FdoRdbmsOvObjectPropertyDefinition* MySqlFdoApplySchemaTest::CreateOvObjectPropertyDefinition(FdoString *name)
-{
- return FdoMySQLOvObjectPropertyDefinition::Create(name);
-}
-
-FdoRdbmsOvPropertyMappingSingle* MySqlFdoApplySchemaTest::CreateOvPropertyMappingSingle()
-{
- return FdoMySQLOvPropertyMappingSingle::Create();
-}
-
-FdoRdbmsOvPropertyMappingConcrete* MySqlFdoApplySchemaTest::CreateOvPropertyMappingConcrete()
-{
- return FdoMySQLOvPropertyMappingConcrete::Create();
-}
-
-void MySqlFdoApplySchemaTest::ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping)
-{
- ((FdoMySQLOvObjectPropertyDefinition*)pObProp)->SetMappingDefinition(dynamic_cast<FdoMySQLOvPropertyMappingDefinition*>(mapping));
-}
-
-void MySqlFdoApplySchemaTest::PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass)
-{
- (dynamic_cast<FdoMySQLOvPropertyMappingRelation*>(pMapping))->SetInternalClass((FdoMySQLOvClassDefinition*)pClass);
-}
-
-void MySqlFdoApplySchemaTest::ShemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner)
-{
- //FDO owner corresponds to a MySQL database.
- ((FdoMySQLOvPhysicalSchemaMapping*)mapping)->SetDatabase( owner );
-}
-
void MySqlFdoApplySchemaTest::VldClassCapabilities( int ltMode, int lckMode, FdoClassDefinition* pClass )
{
// The following verifies that the AcDbEntity class capabilities are valid.
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoApplySchemaTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -37,23 +37,7 @@
virtual FdoRdbmsOvPhysicalSchemaMapping* CreateOverrideDefaults( FdoIConnection* connection, int passNum );
virtual void CreateRdbmsSpecificElements(FdoIConnection* connection, FdoString* wDatastore);
virtual FdoRdbmsOvClassDefinition* CreateOvClassDefinition(FdoString *name = NULL);
- virtual void ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass);
virtual FdoRdbmsOvTable* CreateOvTable(FdoString* name);
- virtual FdoRdbmsOvColumn* CreateOvColumn(FdoString* name);
- virtual FdoRdbmsOvGeometricColumn* CreateOvGeometricColumn(FdoString* name);
- virtual FdoRdbmsOvDataPropertyDefinition* CreateOvDataPropertyDefinition(FdoString *name);
- virtual FdoRdbmsOvGeometricPropertyDefinition* CreateOvGeometricPropertyDefinition(FdoString *name);
- virtual void PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp);
- virtual void ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable);
- virtual void TableOvSetTablespace(FdoRdbmsOvTable* pTable, FdoString *tablespace);
- virtual void DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn);
- virtual void GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn);
- virtual FdoRdbmsOvObjectPropertyDefinition* CreateOvObjectPropertyDefinition(FdoString *name);
- virtual FdoRdbmsOvPropertyMappingSingle* CreateOvPropertyMappingSingle();
- virtual FdoRdbmsOvPropertyMappingConcrete* CreateOvPropertyMappingConcrete();
- virtual void ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping);
- virtual void PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass);
- virtual void ShemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner);
virtual void VldClassCapabilities( int ltMode, int lckMode, FdoClassDefinition* pClass );
Added: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.cpp (rev 0)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2004-2006 Autodesk, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser
+ * General Public License as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "Pch.h"
+#include "MySqlSchemaOverrideUtil.h"
+
+FdoRdbmsOvClassDefinition* MySqlSchemaOverrideUtil::CreateOvClassDefinition(FdoString *name)
+{
+ if (name == NULL)
+ return FdoMySQLOvClassDefinition::Create();
+ else
+ return FdoMySQLOvClassDefinition::Create(name);
+}
+
+void MySqlSchemaOverrideUtil::ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass)
+{
+ FdoMySQLOvClassesP(((FdoMySQLOvPhysicalSchemaMapping*)pSchema)->GetClasses())->Add((FdoMySQLOvClassDefinition*)pClass);
+}
+
+FdoRdbmsOvTable* MySqlSchemaOverrideUtil::CreateOvTable(FdoString* name)
+{
+ FdoPtr<FdoMySQLOvTable> ovTable = FdoMySQLOvTable::Create(name);
+
+ return FDO_SAFE_ADDREF(ovTable.p);
+}
+
+FdoRdbmsOvColumn* MySqlSchemaOverrideUtil::CreateOvColumn(FdoString* name)
+{
+ return FdoMySQLOvColumn::Create(name);
+}
+
+FdoRdbmsOvGeometricColumn* MySqlSchemaOverrideUtil::CreateOvGeometricColumn(FdoString* name)
+{
+ return FdoMySQLOvGeometricColumn::Create(name);
+}
+
+FdoRdbmsOvDataPropertyDefinition* MySqlSchemaOverrideUtil::CreateOvDataPropertyDefinition(FdoString *name)
+{
+ return FdoMySQLOvDataPropertyDefinition::Create(name);
+}
+
+FdoRdbmsOvGeometricPropertyDefinition* MySqlSchemaOverrideUtil::CreateOvGeometricPropertyDefinition(FdoString *name)
+{
+ return FdoMySQLOvGeometricPropertyDefinition::Create(name);
+}
+
+void MySqlSchemaOverrideUtil::PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp)
+{
+ FdoMySQLOvPropertiesP(((FdoMySQLOvClassDefinition*)pClass)->GetProperties())->Add(dynamic_cast<FdoMySQLOvPropertyDefinition*>(pProp));
+}
+
+void MySqlSchemaOverrideUtil::ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable)
+{
+ ((FdoMySQLOvClassDefinition*)pClass)->SetTable((FdoMySQLOvTable*)pTable);
+}
+
+void MySqlSchemaOverrideUtil::DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn)
+{
+ ((FdoMySQLOvDataPropertyDefinition*)pDataProp)->SetColumn((FdoMySQLOvColumn*)pDataColumn);
+}
+
+void MySqlSchemaOverrideUtil::GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn)
+{
+ ((FdoMySQLOvGeometricPropertyDefinition*)pGeomProp)->SetColumn((FdoMySQLOvGeometricColumn*)pGeometricColumn);
+}
+
+FdoRdbmsOvObjectPropertyDefinition* MySqlSchemaOverrideUtil::CreateOvObjectPropertyDefinition(FdoString *name)
+{
+ return FdoMySQLOvObjectPropertyDefinition::Create(name);
+}
+
+FdoRdbmsOvPropertyMappingSingle* MySqlSchemaOverrideUtil::CreateOvPropertyMappingSingle()
+{
+ return FdoMySQLOvPropertyMappingSingle::Create();
+}
+
+FdoRdbmsOvPropertyMappingConcrete* MySqlSchemaOverrideUtil::CreateOvPropertyMappingConcrete()
+{
+ return FdoMySQLOvPropertyMappingConcrete::Create();
+}
+
+void MySqlSchemaOverrideUtil::ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping)
+{
+ ((FdoMySQLOvObjectPropertyDefinition*)pObProp)->SetMappingDefinition(dynamic_cast<FdoMySQLOvPropertyMappingDefinition*>(mapping));
+}
+
+void MySqlSchemaOverrideUtil::PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass)
+{
+ (dynamic_cast<FdoMySQLOvPropertyMappingRelation*>(pMapping))->SetInternalClass((FdoMySQLOvClassDefinition*)pClass);
+}
+
+void MySqlSchemaOverrideUtil::SchemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner)
+{
+ ((FdoMySQLOvPhysicalSchemaMapping*)mapping)->SetDatabase( owner );
+}
+
Added: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.h (rev 0)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaOverrideUtil.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004-2006 Autodesk, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser
+ * General Public License as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef MYSQL_SCHEMAOVERRIDEUTIL_H
+#define MYSQL_SCHEMAOVERRIDEUTIL_H
+
+#include "SchemaOverrideUtil.h"
+#include <Rdbms/Override/MySql/MySqlOvPropertyMappingSingle.h>
+#include <Rdbms/Override/MySql/MySqlOvPropertyMappingConcrete.h>
+#include <Rdbms/Override/MySql/MySqlOvPhysicalSchemaMapping.h>
+
+class MySqlSchemaOverrideUtil : public SchemaOverrideUtil
+{
+ // Helper methods for overrides tests; overriden by each provider:
+ virtual FdoRdbmsOvClassDefinition* CreateOvClassDefinition(FdoString *name = NULL);
+ virtual void ClassesOvAdd(FdoRdbmsOvPhysicalSchemaMapping* pSchema, FdoRdbmsOvClassDefinition* pClass);
+ virtual FdoRdbmsOvTable* CreateOvTable(FdoString* name);
+ virtual FdoRdbmsOvColumn* CreateOvColumn(FdoString* name);
+ virtual FdoRdbmsOvGeometricColumn* CreateOvGeometricColumn(FdoString* name);
+ virtual FdoRdbmsOvDataPropertyDefinition* CreateOvDataPropertyDefinition(FdoString *name);
+ virtual FdoRdbmsOvGeometricPropertyDefinition* CreateOvGeometricPropertyDefinition(FdoString *name);
+ virtual void PropertiesOvAdd(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvPropertyDefinition *pProp);
+ virtual void ClassOvSetTable(FdoRdbmsOvClassDefinition* pClass, FdoRdbmsOvTable* pTable);
+ virtual void DataPropOvSetColumn(FdoRdbmsOvDataPropertyDefinition* pDataProp, FdoRdbmsOvColumn* pDataColumn);
+ virtual void GeometricPropOvSetColumn(FdoRdbmsOvGeometricPropertyDefinition* pGeomProp, FdoRdbmsOvGeometricColumn* pGeometricColumn);
+ virtual FdoRdbmsOvObjectPropertyDefinition* CreateOvObjectPropertyDefinition(FdoString *name);
+ virtual FdoRdbmsOvPropertyMappingSingle* CreateOvPropertyMappingSingle();
+ virtual FdoRdbmsOvPropertyMappingConcrete* CreateOvPropertyMappingConcrete();
+ virtual void ObjectPropertyOvSetMappingDefinition(FdoRdbmsOvObjectPropertyDefinition* pObProp, FdoRdbmsOvPropertyMappingDefinition* mapping);
+ virtual void PropertyMappingOvSetInternalClass(FdoRdbmsOvPropertyMappingRelation* pMapping, FdoRdbmsOvClassDefinition* pClass);
+ virtual void SchemaOvSetOwner(FdoRdbmsOvPhysicalSchemaMapping *mapping, FdoString* owner);
+};
+
+#endif // MySql_FDOAPPLYSCHEMATEST_H
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcDescribeSchemaTest.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcDescribeSchemaTest.cpp 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcDescribeSchemaTest.cpp 2007-03-15 12:39:06 UTC (rev 794)
@@ -48,7 +48,7 @@
void OdbcDescribeSchemaTest::LoadTestData(FdoIConnection* connection)
{
- UnitTestUtil::Sql2Db( (const wchar_t**) mInputSchema, connection );
+ UnitTestUtil::Sql2Db( GetSchema(), connection );
}
void OdbcDescribeSchemaTest::describe()
{
@@ -106,7 +106,6 @@
void OdbcMySqlDescribeSchemaTest::set_provider()
{
- mInputSchema = mSchema;
mInputData = NULL;
UnitTestUtil::SetProvider( "OdbcMySql" );
}
@@ -114,7 +113,6 @@
#ifdef _WIN32
void OdbcSqlServerDescribeSchemaTest::set_provider()
{
- mInputSchema = mSchema;
mInputData = NULL;
UnitTestUtil::SetProvider( "OdbcSqlServer" );
}
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcFdoInsertTest.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcFdoInsertTest.h 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Odbc/OdbcFdoInsertTest.h 2007-03-15 12:39:06 UTC (rev 794)
@@ -42,6 +42,7 @@
virtual void smartPointerInsert() {};
virtual void conditionalInsert() {};
virtual void insertAutoGen() {};
+ virtual void featureReaderTest() {};
virtual bool isPkeyAutogeneratedCities() { return false; }
virtual bool isPkeyAutogeneratedTable1() { return false; }
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestMySql.vcproj
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestMySql.vcproj 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestMySql.vcproj 2007-03-15 12:39:06 UTC (rev 794)
@@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(FDO)\Unmanaged\inc";"$(FDO)\Unmanaged";"$(FDOTHIRDPARTY)\cppunit\include";"$(FDOUTILITIES)\SchemaMgr\inc";"$(FDOUTILITIES)\Common\inc";..\LockManager;..\LongTransactionManager;..\Gdbi;..\..\inc;..\..;..\Fdo\Connection;..\Fdo\SpatialContext;..\Fdo\Other;..\Fdo\FeatureCommands;../;Common;$(FDOUTILITIES)\TestCommon\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;RDBI_STATIC;_CRT_SECURE_NO_DEPRECATE;__CPPUNIT_MFC_APP"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;RDBI_STATIC;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="true"
@@ -696,10 +696,26 @@
>
</File>
<File
+ RelativePath=".\MySql\MySqlSchemaOverrideUtil.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MySql\MySqlSchemaOverrideUtil.h"
+ >
+ </File>
+ <File
RelativePath=".\MySQL\MySqlTestRegister.cpp"
>
</File>
<File
+ RelativePath=".\Common\SchemaOverrideUtil.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Common\SchemaOverrideUtil.h"
+ >
+ </File>
+ <File
RelativePath=".\Common\StringPropertiesDictionary.h"
>
</File>
Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestOdbc.vcproj
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestOdbc.vcproj 2007-03-14 02:13:21 UTC (rev 793)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/UnitTestOdbc.vcproj 2007-03-15 12:39:06 UTC (rev 794)
@@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(FDO)\Unmanaged\inc";"$(FDOTHIRDPARTY)\cppunit\include";"$(FDOUTILITIES)\SchemaMgr\inc";"$(FDO)\Unmanaged";"$(FDOUTILITIES)\Common\inc";..\Gdbi;..\Fdo\Lt;..\Fdo\Other;..\Fdo\Connection;..\Fdo\FeatureCommands;..\Fdo\SpatialContext;..\LongTransactionManager;..\..;..\..\inc;..\..\inc\fdo;../;..\LockManager;Common;$(FDOUTILITIES)\TestCommon\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;RDBI_STATIC;_CRT_SECURE_NO_DEPRECATE;__CPPUNIT_MFC_APP"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;RDBI_STATIC;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="true"
@@ -588,6 +588,14 @@
>
</File>
<File
+ RelativePath=".\Common\SchemaOverrideUtil.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Common\SchemaOverrideUtil.h"
+ >
+ </File>
+ <File
RelativePath=".\Common\StringPropertiesDictionary.h"
>
</File>
More information about the fdo-commits
mailing list