[fdo-commits] r767 - in branches/3.2.1: Fdo/Unmanaged/Src/Fdo/Schema Fdo/Unmanaged/Src/Message Utilities/SchemaMgr/Src/Sm/Ph/Rd

svn_fdo at osgeo.org svn_fdo at osgeo.org
Tue Feb 13 12:06:52 EST 2007


Author: brentrobinson
Date: 2007-02-13 12:06:52 -0500 (Tue, 13 Feb 2007)
New Revision: 767

Modified:
   branches/3.2.1/Fdo/Unmanaged/Src/Fdo/Schema/AssociationPropertyDefinition.cpp
   branches/3.2.1/Fdo/Unmanaged/Src/Message/FDOMessage.mc
   branches/3.2.1/Utilities/SchemaMgr/Src/Sm/Ph/Rd/PropertyReader.cpp
Log:
Ported from 3.2.x branch - Skip Foreign Key with column type mismatch

Modified: branches/3.2.1/Fdo/Unmanaged/Src/Fdo/Schema/AssociationPropertyDefinition.cpp
===================================================================
--- branches/3.2.1/Fdo/Unmanaged/Src/Fdo/Schema/AssociationPropertyDefinition.cpp	2007-02-13 06:24:24 UTC (rev 766)
+++ branches/3.2.1/Fdo/Unmanaged/Src/Fdo/Schema/AssociationPropertyDefinition.cpp	2007-02-13 17:06:52 UTC (rev 767)
@@ -346,13 +346,13 @@
     // Cannot create an association property without the associated class
     if( m_associatedClass == NULL )
     {
-        throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_55_ASSOCIATEDCLASSREQUIRED), GetName() ));
+        throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_55_ASSOCIATEDCLASSREQUIRED), (FdoString*) GetQualifiedName() ));
     }
 
     if( m_identityProperties && m_identityReverseProperties )
     {
         if( m_identityProperties->GetCount() != m_identityReverseProperties->GetCount() )
-            throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_17_ASSOCIATIONMISSMATCHERROR)));
+            throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_17_ASSOCIATIONMISSMATCHERROR), (FdoString*) GetQualifiedName() ));
         
         // Make sure that the identity properties and reverse properties are of the same types
         for( int i=0; i<m_identityProperties->GetCount(); i++ )
@@ -361,7 +361,7 @@
             FdoPtr<FdoDataPropertyDefinition> revprop = m_identityReverseProperties->GetItem( i );
             if( indprop->GetDataType() != revprop->GetDataType() )
             {
-                throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_17_ASSOCIATIONMISSMATCHERROR)));
+                throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_17_ASSOCIATIONMISSMATCHERROR), (FdoString*) GetQualifiedName() ));
             }
         }
 
@@ -373,7 +373,7 @@
                 FdoPtr<FdoDataPropertyDefinition> revprop = m_identityReverseProperties->GetItem( i );
                 if( revprop->GetIsAutoGenerated() || revprop->GetIsSystem() )
                 {
-                    throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_53_BADASSOCREVERSEPROP)));
+                    throw FdoSchemaException::Create(FdoException::NLSGetMessage(FDO_NLSID(SCHEMA_53_BADASSOCREVERSEPROP), (FdoString*) GetQualifiedName() ));
                 }
             }
         }

Modified: branches/3.2.1/Fdo/Unmanaged/Src/Message/FDOMessage.mc
===================================================================
--- branches/3.2.1/Fdo/Unmanaged/Src/Message/FDOMessage.mc	2007-02-13 06:24:24 UTC (rev 766)
+++ branches/3.2.1/Fdo/Unmanaged/Src/Message/FDOMessage.mc	2007-02-13 17:06:52 UTC (rev 767)
@@ -159,7 +159,7 @@
 MessageId=1017
 SymbolicName=SCHEMA_17_ASSOCIATIONMISSMATCHERROR
 Language=English
-Type or number missmatch between the identity properties and the reverse identity properties. 
+Association Property '%1$ls' has type or number missmatch between the identity properties and the reverse identity properties. 
 .
 MessageId=1018
 SymbolicName=SCHEMA_18_ASSOCIATIONIDENTITYERROR
@@ -339,7 +339,7 @@
 MessageId=1053
 SymbolicName=SCHEMA_53_BADASSOCREVERSEPROP
 Language=English
-Cannot use auto-generated or system properties as reverse identity properties
+Cannot use auto-generated or system properties as reverse identity properties for association property '%1$ls'
 .
 MessageId=1054
 SymbolicName=SCHEMA_54_AUTOGENREADONLY

Modified: branches/3.2.1/Utilities/SchemaMgr/Src/Sm/Ph/Rd/PropertyReader.cpp
===================================================================
--- branches/3.2.1/Utilities/SchemaMgr/Src/Sm/Ph/Rd/PropertyReader.cpp	2007-02-13 06:24:24 UTC (rev 766)
+++ branches/3.2.1/Utilities/SchemaMgr/Src/Sm/Ph/Rd/PropertyReader.cpp	2007-02-13 17:06:52 UTC (rev 767)
@@ -302,24 +302,44 @@
 bool FdoSmPhRdPropertyReader::CheckFkey( FdoSmPhFkeyP fkey )
 {
     FdoInt32 idx;
-    FdoSmPhColumnP column;
+    FdoSmPhColumnP fkeyColumn;
+    FdoSmPhColumnP pkeyColumn;
 
     FdoSmPhColumnsP fkeyColumns = fkey->GetFkeyColumns();
+    FdoSmPhColumnsP pkeyColumns = fkey->GetPkeyColumns();
 
+    if ( fkeyColumns->GetCount() != pkeyColumns->GetCount() ) 
+        // This would be a malformed foreign key so skip it.
+        return false;
+
     for ( idx = 0; idx < fkeyColumns->GetCount(); idx++ ) {
-        column = fkeyColumns->GetItem( idx );
+        fkeyColumn = fkeyColumns->GetItem( idx );
 
-        if ( !CheckColumn(column) )
+        if ( !CheckColumn(fkeyColumn) )
+            // Skipping fkey column so skip entire foreign key
             return false;
-    }
 
-    FdoSmPhColumnsP pkeyColumns = fkey->GetPkeyColumns();
+        pkeyColumn = pkeyColumns->GetItem( idx );
 
-    for ( idx = 0; idx < pkeyColumns->GetCount(); idx++ ) {
-        column = pkeyColumns->GetItem( idx );
+        if ( !CheckColumn(pkeyColumn) )
+            // Skipping pkey column so skip entire foreign key
+            return false;
 
-        if ( !CheckColumn(column) )
+        if ( fkeyColumn->GetType() != pkeyColumn->GetType() ) 
+            // FDO does not support association properties whose corresponding
+            // identity property pairs aren't of the same type. This foreign key
+            // generates such an association property so skip it. 
             return false;
+
+        if ( fkeyColumn->GetType() == FdoSmPhColType_Geom ) 
+            // FDO Association property does not support geometric properties as identity properties
+            return false;
+
+        if ( fkeyColumn->GetAutoincrement() ) 
+            // Association reverse identity properties cannot be autogenerated so skip
+            // foreign keys with autogenerated fkey columns.
+            return false;
+
     }
 
     return true;



More information about the fdo-commits mailing list