[fdo-commits] r742 - in branches/3.2.x/Providers/GenericRdbms/Src/UnitTest: . Common

svn_fdo at osgeo.org svn_fdo at osgeo.org
Tue Feb 13 18:28:35 EST 2007


Author: brentrobinson
Date: 2007-02-13 18:28:33 -0500 (Tue, 13 Feb 2007)
New Revision: 742

Modified:
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.cpp
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.h
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_MySql_master.txt
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_Oracle_master.txt
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer2005_master.txt
   branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer_master.txt
Log:
View to Fdo ClassDefinition Support.

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.cpp	2007-02-13 22:59:04 UTC (rev 741)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.cpp	2007-02-13 23:28:33 UTC (rev 742)
@@ -22,6 +22,7 @@
 #include "ConnectionUtil.h"
 #include <Sm/Ph/Rd/ConstraintReader.h>
 #include <Sm/Ph/SpatialIndex.h>
+#include "../SchemaMgr/Ph/Owner.h"
 
 FdoString* SchemaMgrTests::DB_NAME_SUFFIX =           L"_schema_mgr";
 FdoString* SchemaMgrTests::DB_NAME_COPY_SUFFIX =      L"_schema_mgr_copy";
@@ -139,6 +140,8 @@
 
         FdoSmPhViewP view1 = owner->CreateView( phMgr->GetDcDbObjectName(L"VIEW1"), L"", owner->GetName(), phMgr->GetDcDbObjectName(L"TABLE1" ));
         column = view1->CreateColumnInt32( L"ID", false, false, L"ID" );
+        if ( SupportsViewPkey() ) 
+            view1->AddPkeyCol( L"ID" );
         column = view1->CreateColumnDecimal( L"DEC_COL_RENAME", true, 10, 5, L"DECIMAL_COLUMN" );
         column = view1->CreateColumnByte( L"BYTE_COLUMN", true, L"BYTE_COLUMN" );
 
@@ -181,9 +184,18 @@
         FdoSmPhViewP view2 = owner->CreateView( phMgr->GetDcDbObjectName(L"VIEW2"), L"", owner->GetName(), phMgr->GetDcDbObjectName(L"TABLE2" ));
         column = view2->CreateColumnInt32( L"ID", false, false, L"ID" );
         column = view2->CreateColumnChar( L"STRING_COLUMN", false, 50, L"STRING_COLUMN" );
+
         column = view2->CreateColumnDouble( L"DOUBLE_COLUMN", true, L"DOUBLE_COLUMN" );
         column = view2->CreateColumnGeom( L"GEOM_COLUMN", (FdoSmPhScInfo*) NULL, true, true, false, L"GEOM_COLUMN" );
 
+        FdoSmPhViewP view3 = owner->CreateView( phMgr->GetDcDbObjectName(L"VIEW3"), L"", owner->GetName(), phMgr->GetDcDbObjectName(L"TABLE4" ));
+        column = view3->CreateColumnInt32( L"ID", false, false, L"ID" );
+        column = view3->CreateColumnChar( L"STRING_COLUMN", false, 50, L"STRING_COLUMN" );
+        if ( SupportsViewPkey() ) 
+            view3->AddPkeyCol( column->GetName() );
+        column = view3->CreateColumnInt16( L"INT16_COLUMN", true, false, L"INT16_COLUMN" );
+        column = view3->CreateColumnGeom( L"GEOM_COLUMN", (FdoSmPhScInfo*) NULL, true, true, false, L"GEOM_COLUMN" );
+
 #ifndef RDBI_DEF_SSQL
         table = owner->CreateTable( phMgr->GetDcDbObjectName(L"TABLE5" ));
         column = table->CreateColumnDecimal( L"ID", false, 10, 2 );
@@ -354,6 +366,19 @@
                     pCmd->SetPhysicalMapping( overrides );
             }
 
+            // Special case for MySQL. Classes from views do not get identity.
+            // class "view3" is a feature class since it has geometry.
+            // However, feature classes without identity are not allowed in FDO-enabled 
+            // datastores, so remove this class when it has no identity.
+
+            FdoClassesP classes = schema->GetClasses();
+            FdoClassDefinitionP view3Class = classes->FindItem( L"view3" );
+            if ( view3Class && (view3Class->GetClassType() == FdoClassType_FeatureClass) ) {
+                FdoDataPropertiesP idProps = view3Class->GetIdentityProperties();
+                if ( idProps->GetCount() == 0 )
+                    classes->Remove( view3Class );
+            }
+
             pCmd->Execute();
         }
 
@@ -743,29 +768,52 @@
         AddPkey( table );
         AddIndex( table, true, L"ALT_KEY1", L"INT16_COL1" );
 
+        FdoSmPhViewP view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX1A"), table->GetName() );
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX1B"), view->GetName() );
+        FdoSmPhColumnsP columns = view->GetColumns();
+        columns->RemoveAt( columns->IndexOf(phMgr->GetDcColumnName(L"ID")) );
+
         // Tests choosing heavier index with fewer columns
         table = CreateIxTable(owner, L"TABLE_IX2", 0 );
         AddIndex( table, true, L"IX_21", L"INT16_COL1 INT16_COL2" );
         AddIndex( table, true, L"IX_22", L"STRING_COL5" );
 
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX2A"), table->GetName() );
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX2B"), view->GetName() );
+        columns = view->GetColumns();
+        columns->RemoveAt( columns->IndexOf(phMgr->GetDcColumnName(L"STRING_COL5")) );
+
+        FdoStringP createIx2cSql = FdoStringP::Format( 
+            L"create view view_ix2c ( id, int16_col1 ) as select id, int16_col1 from %ls", 
+            (FdoString*)(view->GetDbQName())
+        );
+
         // Multi-column index tests
         table = CreateIxTable(owner, L"TABLE_IX3", 0 );
         AddIndex( table, true, L"IX_31", L"INT16_COL1 INT16_COL2" );
         AddIndex( table, true, L"IX_32", L"STRING_COL1 STRING_COL2" );
         AddIndex( table, true, L"IX_33", L"INT16_COL1 STRING_COL1" );
 
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX3A"), table->GetName() );
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX3B"), view->GetName() );
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX3C"), view->GetName() );
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX3D"), view->GetName() );
+
         // string column tests
         table = CreateIxTable(owner, L"TABLE_IX4", 0 );
         AddIndex( table, true, L"IX_41", L"STRING_COL1" );
         AddIndex( table, true, L"IX_42", L"INT16_COL1" );
         AddIndex( table, true, L"IX_43", L"STRING_COL2" );
 
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX4A"), table->GetName() );
+
         // Test skipping index that is too heavy.
         // This index is too long to create on MySql or SqlServer so
         // test only for Oracle.
 #ifdef RDBI_DEF_ORA
         table = CreateIxTable(owner, L"TABLE_IX5", 0 );
         AddIndex( table, true, L"IX_51", L"STRING_COL3 STRING_COL4" );
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX5A"), table->GetName() );
 #endif
 
         // Test skipping non-unique index
@@ -774,17 +822,50 @@
         AddIndex( table, true, L"IX_62", L"STRING_COL1 STRING_COL2" );
         AddIndex( table, false, L"IX_63", L"INT16_COL1 STRING_COL2" );
 
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX6A"), table->GetName() );
+        FdoStringP createIx6bSql = FdoStringP::Format( 
+            L"create view view_ix6b ( icol1, icol2, string_col1, string_col2 ) as select int16_col1, int16_col2, string_col1, string_col2 from %ls", 
+            (FdoString*)(view->GetDbQName())
+        );
+
+        FdoStringP createIx6cSql = FdoStringP::Format( 
+            L"create view view_ix6c ( string_col1, int16_col2, int16_col1, string_col2 ) as select int16_col1, int16_col2, string_col1, string_col2 from %ls", 
+            (FdoString*)(view->GetDbQName())
+        );
+
         // Test date columns
         table = CreateIxTable(owner, L"TABLE_IX7", 0 );
         AddIndex( table, true, L"IX_71", L"DATE_COL1 STRING_COL2" );
         AddIndex( table, true, L"IX_72", L"STRING_COL5 STRING_COL2" );
         AddIndex( table, true, L"IX_73", L"STRING_COL6 STRING_COL2" );
 
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX7A"), table->GetName() );
+
         // Test id'less table.
         table = CreateIxTable(owner, phMgr->GetDcDbObjectName(L"TABLE_IX8"), 0 );
 
+        view = CreateIxView( owner, phMgr->GetDcDbObjectName(L"VIEW_IX8A"), table->GetName() );
+
+        FdoStringP createJoinSql = L"create view view_join ( id, string_col5 ) as select a.id, b.string_col5 from table_ix1 a, table_ix2 b";
+
         database->Commit();
 
+        FdoSmPhGrdOwnerP grdOwner = owner->SmartCast<FdoSmPhGrdOwner>();
+
+        grdOwner->ActivateAndExecute( (FdoString*) createIx2cSql );
+        grdOwner->ActivateAndExecute( (FdoString*) createIx6bSql );
+        grdOwner->ActivateAndExecute( (FdoString*) createIx6cSql );
+        grdOwner->ActivateAndExecute( (FdoString*) createJoinSql );
+
+        mgr = NULL;
+        phMgr = NULL;
+        conn->disconnect();
+        delete conn;
+        conn = CreateStaticConnection();
+        conn->connect();
+        mgr = conn->CreateSchemaManager();
+        phMgr = mgr->GetPhysicalSchema()->SmartCast<FdoSmPhGrdMgr>();
+
         printf( "Autogenerating schema from datastore ...\n" );
 
         fdoConn = UnitTestUtil::CreateConnection(
@@ -799,63 +880,144 @@
         FdoClassesP classes = schema->GetClasses();
 
 #ifdef RDBI_DEF_ORA
-        CPPUNIT_ASSERT( classes->GetCount() == 8 );
+        CPPUNIT_ASSERT( classes->GetCount() == 25 );
 #else
-        CPPUNIT_ASSERT( classes->GetCount() == 7 );
+        CPPUNIT_ASSERT( classes->GetCount() == 23 );
 #endif
+        FdoInt32 pass;
+        FdoClassDefinitionP featClass;
+        FdoDataPropertiesP idProps;
+        FdoDataPropertyP prop;
 
-        FdoClassDefinitionP featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX1") );
-        FdoDataPropertiesP idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 1 );
-        FdoDataPropertyP prop = idProps->GetItem(0);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"ID")) == 0 );
+        for ( pass = 0; pass < 2; pass++ ) {
+            featClass = classes->GetItem( table2class(phMgr, (pass==0) ? L"TABLE_IX1" : L"VIEW_IX1A") );
+            idProps = featClass->GetIdentityProperties();
+            if ( SupportsBaseObjects() || (pass == 0) ) {
+                CPPUNIT_ASSERT( idProps->GetCount() == 1 );
+                prop = idProps->GetItem(0);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"ID")) == 0 );
+            }
+            else {
+                CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+            }
 
-        featClass = classes->GetItem( table2class(phMgr,"TABLE_IX2") );
-        idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 1 );
-        prop = idProps->GetItem(0);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL5")) == 0 );
+            featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX2" : L"VIEW_IX2A") );
+            idProps = featClass->GetIdentityProperties();
+            if ( SupportsBaseObjects() || (pass == 0) ) {
+                CPPUNIT_ASSERT( idProps->GetCount() == 1 );
+                prop = idProps->GetItem(0);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL5")) == 0 );
+            }
+            else {
+                CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+            }
 
-        featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX3") );
-        idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 2 );
-        prop = idProps->GetItem(0);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
-        prop = idProps->GetItem(1);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL2")) == 0 );
+            featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX3" : L"VIEW_IX3A") );
+            idProps = featClass->GetIdentityProperties();
+            if ( SupportsBaseObjects() || (pass == 0) ) {
+                CPPUNIT_ASSERT( idProps->GetCount() == 2 );
+                prop = idProps->GetItem(0);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
+                prop = idProps->GetItem(1);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL2")) == 0 );
+            }
+            else {
+                CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+            }
 
-        featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX4") );
-        idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 1 );
-        prop = idProps->GetItem(0);
+            featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX4" : L"VIEW_IX4A") );
+            idProps = featClass->GetIdentityProperties();
+            if ( SupportsBaseObjects() || (pass == 0) ) {
+                CPPUNIT_ASSERT( idProps->GetCount() == 1 );
+                prop = idProps->GetItem(0);
 #ifdef RDBI_DEF_ORA
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL2")) == 0 );
-		featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX5") );
-		idProps = featClass->GetIdentityProperties();
-		CPPUNIT_ASSERT( idProps->GetCount() == 0 );        
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL2")) == 0 );
+		        featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX5" : L"VIEW_IX5A") );
+		        idProps = featClass->GetIdentityProperties();
+		        CPPUNIT_ASSERT( idProps->GetCount() == 0 );        
 #else
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
 #endif
-        featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX6") );
-        idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 2 );
-        prop = idProps->GetItem(0);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
-        prop = idProps->GetItem(1);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL2")) == 0 );
+            }
 
-        featClass = classes->GetItem( table2class(phMgr,"TABLE_IX7") );
-        idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 2 );
-        prop = idProps->GetItem(0);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL5")) == 0 );
-        prop = idProps->GetItem(1);
-        CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL2")) == 0 );
+            featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX6" : L"VIEW_IX6A") );
+            idProps = featClass->GetIdentityProperties();
+            if ( SupportsBaseObjects() || (pass == 0) ) {
+                CPPUNIT_ASSERT( idProps->GetCount() == 2 );
+                prop = idProps->GetItem(0);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
+                prop = idProps->GetItem(1);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL2")) == 0 );
+            }
+            else {
+                CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+            }
 
-        featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX8") );
-        idProps = featClass->GetIdentityProperties();
-        CPPUNIT_ASSERT( idProps->GetCount() == 0 );        
+            featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX7" : L"VIEW_IX7A") );
+            idProps = featClass->GetIdentityProperties();
+            if ( SupportsBaseObjects() || (pass == 0) ) {
+                CPPUNIT_ASSERT( idProps->GetCount() == 2 );
+                prop = idProps->GetItem(0);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL5")) == 0 );
+                prop = idProps->GetItem(1);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL2")) == 0 );
+            }
+            else {
+                CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+            }
 
+            featClass = classes->GetItem( table2class(phMgr,(pass==0) ? L"TABLE_IX8" : L"VIEW_IX8A") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 0 );        
+        }
+
+        if ( SupportsBaseObjects() ) {
+            featClass = classes->GetItem( table2class(phMgr, L"VIEW_IX1B") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 1 );
+            prop = idProps->GetItem(0);
+            CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
+
+            featClass = classes->GetItem( table2class(phMgr, L"VIEW_IX2B") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 2 );
+            prop = idProps->GetItem(0);
+            CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
+            prop = idProps->GetItem(1);
+            CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL2")) == 0 );
+
+            featClass = classes->GetItem( table2class(phMgr, L"VIEW_IX2C") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+
+            for ( pass = 0; pass < 3; pass++ ) {
+                FdoStringP viewName = FdoStringP::Format( L"VIEW_IX3%c", 'B' + pass );
+                featClass = classes->GetItem( table2class(phMgr, viewName) );
+                idProps = featClass->GetIdentityProperties();
+                CPPUNIT_ASSERT( idProps->GetCount() == 2 );
+                prop = idProps->GetItem(0);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL1")) == 0 );
+                prop = idProps->GetItem(1);
+                CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"INT16_COL2")) == 0 );
+            }
+
+            featClass = classes->GetItem( table2class(phMgr, L"VIEW_IX6B") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 2 );
+            prop = idProps->GetItem(0);
+            CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL1")) == 0 );
+            prop = idProps->GetItem(1);
+            CPPUNIT_ASSERT( wcscmp(prop->GetName(), phMgr->GetDcColumnName(L"STRING_COL2")) == 0 );
+
+            featClass = classes->GetItem( table2class(phMgr, L"VIEW_IX6C") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+
+            featClass = classes->GetItem( table2class(phMgr, L"VIEW_JOIN") );
+            idProps = featClass->GetIdentityProperties();
+            CPPUNIT_ASSERT( idProps->GetCount() == 0 );
+        }
+
         UnitTestUtil::CloseConnection( fdoConn, false, L"_schema_mgr" );
 
         printf( "Updating original schema ...\n" );
@@ -906,9 +1068,9 @@
         classes = schema->GetClasses();
 
 #ifdef RDBI_DEF_ORA
-        CPPUNIT_ASSERT( classes->GetCount() == 8 );
+        CPPUNIT_ASSERT( classes->GetCount() == 25 );
 #else
-        CPPUNIT_ASSERT( classes->GetCount() == 7 );
+        CPPUNIT_ASSERT( classes->GetCount() ==  23);
 #endif
         featClass = classes->GetItem( table2class(phMgr,L"TABLE_IX2") );
         idProps = featClass->GetIdentityProperties();
@@ -1231,6 +1393,35 @@
     return table;
 }
 
+FdoSmPhViewP SchemaMgrTests::CreateIxView( FdoSmPhOwnerP owner, FdoStringP viewName, FdoStringP tableName )   
+{
+    FdoSmPhMgrP phMgr = owner->GetManager();
+
+    FdoSmPhViewP view = owner->CreateView( phMgr->GetDcDbObjectName(viewName), L"", owner->GetName(), tableName );
+    FdoStringP columnName = phMgr->GetDcColumnName(L"ID");
+    FdoSmPhColumnP column = view->CreateColumnInt32( columnName, false, false, columnName );
+    columnName = phMgr->GetDcColumnName(L"INT16_COL1");
+    column = view->CreateColumnInt16( columnName, false, false, columnName );
+    columnName = phMgr->GetDcColumnName(L"INT16_COL2");
+    column = view->CreateColumnInt16( columnName, false, false, columnName );
+    columnName = phMgr->GetDcColumnName(L"STRING_COL1");
+    column = view->CreateColumnChar( columnName, false, 10, columnName );
+    columnName = phMgr->GetDcColumnName(L"STRING_COL2");
+    column = view->CreateColumnChar( columnName, false, 7, columnName );
+    columnName = phMgr->GetDcColumnName(L"STRING_COL3");
+    column = view->CreateColumnChar( columnName, false, 2500, columnName );
+    columnName = phMgr->GetDcColumnName(L"STRING_COL4");
+    column = view->CreateColumnChar( columnName, false, 2501, columnName );
+    columnName = phMgr->GetDcColumnName(L"STRING_COL5");
+    column = view->CreateColumnChar( columnName, false, 49, columnName );
+    columnName = phMgr->GetDcColumnName(L"STRING_COL6");
+    column = view->CreateColumnChar( columnName, false, 51, columnName );
+    columnName = phMgr->GetDcColumnName(L"DATE_COL1");
+    column = view->CreateColumnDate( columnName, false, columnName );
+
+    return view;
+}
+
 void SchemaMgrTests::AddPkey( FdoSmPhTableP table )
 {
     if ( FdoPtr<FdoSmPhColumn>(table->GetColumns()->FindItem(L"ID")) ) 
@@ -1421,3 +1612,13 @@
 
     return assocName;
 }
+
+bool SchemaMgrTests::SupportsBaseObjects()
+{
+    return false;
+}
+
+bool SchemaMgrTests::SupportsViewPkey()
+{
+    return false;
+}

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.h
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.h	2007-02-13 22:59:04 UTC (rev 741)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/Common/SchemaMgrTests.h	2007-02-13 23:28:33 UTC (rev 742)
@@ -91,12 +91,16 @@
     void CreateTableGroup( FdoSmPhOwnerP owner, FdoStringP prefix, FdoInt32 count, int lt_mode );
     void CreateFkey( FdoSmPhOwnerP owner, FdoStringP fTableName, FdoStringP pTableName, FdoStringP pOwnerName = L"" );
 
+    virtual bool SupportsBaseObjects();
+    virtual bool SupportsViewPkey();
+
     static FdoString* DB_NAME_SUFFIX;
     static FdoString* DB_NAME_COPY_SUFFIX;
     static FdoString* DB_NAME_FOREIGN_SUFFIX;
 
 private:
     FdoSmPhTableP CreateIxTable( FdoSmPhOwnerP owner, FdoStringP tableName, int lt_mode );
+    FdoSmPhViewP CreateIxView( FdoSmPhOwnerP owner, FdoStringP viewName, FdoStringP tableName );
     void AddPkey( FdoSmPhTableP table );
     void AddIndex( FdoSmPhTableP table, bool unique, FdoStringP indexName, FdoStringP columns );
     void SetLtLck( FdoSmPhTableP table, int lt_mode );

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_MySql_master.txt
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_MySql_master.txt	2007-02-13 22:59:04 UTC (rev 741)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_MySql_master.txt	2007-02-13 23:28:33 UTC (rev 742)
@@ -867,5 +867,39 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:complexType name="view1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:sequence>
+<xs:element name="BYTE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="fdo:byte"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="DEC_COL_RENAME" minOccurs="0">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="10"/>
+<xs:fractionDigits value="5"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="ID">
+<xs:simpleType>
+<xs:restriction base="fdo:int32"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:complexType>
 </xs:schema>
 </fdo:DataStore>

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_Oracle_master.txt
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_Oracle_master.txt	2007-02-13 22:59:04 UTC (rev 741)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_Oracle_master.txt	2007-02-13 23:28:33 UTC (rev 742)
@@ -2051,5 +2051,109 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="VIEW1" type="AutoGen:VIEW1Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="VIEW1Key">
+<xs:selector xpath=".//VIEW1"/>
+<xs:field xpath="ID"/>
+</xs:key>
+</xs:element>
+<xs:complexType name="VIEW1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:complexContent>
+<xs:extension base="fdo:ClassType">
+<xs:sequence>
+<xs:element name="BYTE_COLUMN" minOccurs="0">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="3"/>
+<xs:fractionDigits value=""/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="DEC_COL_RENAME" minOccurs="0">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="10"/>
+<xs:fractionDigits value="5"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="ID">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="10"/>
+<xs:fractionDigits value=""/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
+<xs:element name="VIEW3" type="AutoGen:VIEW3Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="VIEW3Key">
+<xs:selector xpath=".//VIEW3"/>
+<xs:field xpath="STRING_COLUMN"/>
+</xs:key>
+</xs:element>
+<xs:complexType name="VIEW3Type" abstract="false" fdo:geometryName="GEOM_COLUMN">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:complexContent>
+<xs:extension base="gml:AbstractFeatureType">
+<xs:sequence>
+<xs:element name="GEOM_COLUMN" type="gml:AbstractGeometryType" fdo:hasMeasure="false" fdo:hasElevation="true" fdo:srsName="SC_1" fdo:geometricTypes="point curve surface " fdo:geometryTypes="point multipoint linestring multilinestring curvestring multicurvestring polygon multipolygon curvepolygon multicurvepolygon ">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="ID">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="10"/>
+<xs:fractionDigits value=""/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="INT16_COLUMN" minOccurs="0">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="5"/>
+<xs:fractionDigits value=""/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="STRING_COLUMN">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:string">
+<xs:maxLength value="50"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
 </xs:schema>
 </fdo:DataStore>

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer2005_master.txt
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer2005_master.txt	2007-02-13 22:59:04 UTC (rev 741)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer2005_master.txt	2007-02-13 23:28:33 UTC (rev 742)
@@ -677,6 +677,81 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:complexType name="view1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:sequence>
+<xs:element name="BYTE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="fdo:byte"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="DEC_COL_RENAME" minOccurs="0">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="10"/>
+<xs:fractionDigits value="5"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="ID">
+<xs:simpleType>
+<xs:restriction base="fdo:int32"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="view3Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:sequence>
+<xs:element name="GEOM_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:hexBinary"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="ID">
+<xs:simpleType>
+<xs:restriction base="fdo:int32"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="INT16_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="fdo:int16"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="STRING_COLUMN">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:string">
+<xs:maxLength value="50"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+</xs:sequence>
+</xs:complexType>
 </xs:schema>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://fdo.osgeo.org/schemas/feature/guest" xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:gml="http://www.opengis.net/gml" xmlns:guest="http://fdo.osgeo.org/schemas/feature/guest" elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:annotation>

Modified: branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer_master.txt
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer_master.txt	2007-02-13 22:59:04 UTC (rev 741)
+++ branches/3.2.x/Providers/GenericRdbms/Src/UnitTest/gen_default1_SqlServer_master.txt	2007-02-13 23:28:33 UTC (rev 742)
@@ -677,6 +677,81 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:complexType name="view1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:sequence>
+<xs:element name="BYTE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="fdo:byte"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="DEC_COL_RENAME" minOccurs="0">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:decimal">
+<xs:totalDigits value="10"/>
+<xs:fractionDigits value="5"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+<xs:element name="ID">
+<xs:simpleType>
+<xs:restriction base="fdo:int32"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="view3Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:sequence>
+<xs:element name="GEOM_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:hexBinary"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="ID">
+<xs:simpleType>
+<xs:restriction base="fdo:int32"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="INT16_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="fdo:int16"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+<xs:element name="STRING_COLUMN">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:simpleType>
+<xs:restriction base="xs:string">
+<xs:maxLength value="50"/>
+</xs:restriction>
+</xs:simpleType>
+</xs:element>
+</xs:sequence>
+</xs:complexType>
 </xs:schema>
 <SchemaMapping xmlns:rdb="http://fdordbms.osgeo.org/schemas" xmlns="http://www.autodesk.com/isd/fdo/SqlServerProvider" textInRow="NotInRow" provider="Autodesk.SqlServer.3.2" name="dbo">
 <complexType name="rtable1Type" identityIsGloballyUnique="false" identitySeed="0" identityIncrement="0" identityPropertyName="">



More information about the fdo-commits mailing list