[fdo-commits] r2607 - in trunk: Providers/GenericRdbms/Src/MySQL/Driver Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd Providers/GenericRdbms/Src/SchemaMgr/Ov Providers/GenericRdbms/Src/UnitTest Providers/GenericRdbms/Src/UnitTest/Common Utilities/SchemaMgr/Inc/Sm/Ph Utilities/SchemaMgr/Src/Sm/Ph Utilities/SchemaMgr/Src/Sm/Ph/Mt Utilities/TestCommon/Src

svn_fdo at osgeo.org svn_fdo at osgeo.org
Fri Feb 23 09:42:21 EST 2007


Author: brentrobinson
Date: 2007-02-23 09:42:21 -0500 (Fri, 23 Feb 2007)
New Revision: 2607

Modified:
   trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.h
   trunk/Providers/GenericRdbms/Src/SchemaMgr/Ov/RdbmsOvPropertyMappingRelation.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out1_master.txt
   trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out2_master.txt
   trunk/Providers/GenericRdbms/Src/UnitTest/schemaGenConfig1_master.txt
   trunk/Utilities/SchemaMgr/Inc/Sm/Ph/Owner.h
   trunk/Utilities/SchemaMgr/Src/Sm/Ph/Mt/ClassReader.cpp
   trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp
   trunk/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp
Log:
Ticket #18: Merged revisions 810 (Utilities) and 770 (providers/GenericRdbms) from 3.2.x branch:
Views Support: Performance (bulk load primary keys when datastore has MetaSchema) and memory leak fixes


Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c	2007-02-23 14:42:21 UTC (rev 2607)
@@ -60,6 +60,12 @@
         cursor->bind_count = 0;
         cursor->binds = (MYSQL_BIND *)NULL;
     }
+
+    if ((int *)NULL != cursor->srids)
+    {
+        free (cursor->srids);
+        cursor->srids = (int *)NULL;
+    }
 }
 
 int mysql_fre_cursor (mysql_context_def *context, char **cursor)

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -402,7 +402,7 @@
 {
     FdoSmPhMySqlDbObject* pDbObject = (FdoSmPhMySqlDbObject*) this;
 
-    return new FdoSmPhRdMySqlPkeyReader( pDbObject->GetManager(), FDO_SAFE_ADDREF(pDbObject) );
+    return new FdoSmPhRdMySqlPkeyReader( FDO_SAFE_ADDREF(pDbObject) );
 }
 
 FdoPtr<FdoSmPhRdFkeyReader> FdoSmPhMySqlDbObject::CreateFkeyReader() const

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -457,9 +457,16 @@
 {
     FdoSmPhMySqlOwner* pOwner = (FdoSmPhMySqlOwner*) this;
 
-    return new FdoSmPhRdMySqlPkeyReader( pOwner->GetManager(), FDO_SAFE_ADDREF(pOwner) );
+    return new FdoSmPhRdMySqlPkeyReader( FDO_SAFE_ADDREF(pOwner) );
 }
 
+FdoPtr<FdoSmPhRdPkeyReader> FdoSmPhMySqlOwner::CreatePkeyReader( FdoPtr<FdoSmPhRdTableJoin> join ) const
+{
+    FdoSmPhMySqlOwner* pOwner = (FdoSmPhMySqlOwner*) this;
+
+    return new FdoSmPhRdMySqlPkeyReader( FDO_SAFE_ADDREF(pOwner), join );
+}
+
 FdoPtr<FdoSmPhRdColumnReader> FdoSmPhMySqlOwner::CreateColumnReader() const
 {
     FdoSmPhMySqlOwner* pOwner = (FdoSmPhMySqlOwner*) this;

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h	2007-02-23 14:42:21 UTC (rev 2607)
@@ -109,6 +109,8 @@
 
     virtual FdoPtr<FdoSmPhRdPkeyReader> CreatePkeyReader() const;
 
+    virtual FdoPtr<FdoSmPhRdPkeyReader> CreatePkeyReader( FdoPtr<FdoSmPhRdTableJoin> join ) const;
+
     virtual FdoPtr<FdoSmPhRdColumnReader> CreateColumnReader() const;
 
     virtual FdoPtr<FdoSmPhRdColumnReader> CreateColumnReader( FdoSmPhRdTableJoinP join ) const;

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -20,24 +20,52 @@
 #include "PkeyReader.h"
 #include "../Owner.h"
 #include "../../../../SchemaMgr/Ph/Rd/QueryReader.h"
+#include <Sm/Ph/Rd/DbObjectBinds.h>
 
 FdoSmPhRdMySqlPkeyReader::FdoSmPhRdMySqlPkeyReader(
-    FdoSmPhMgrP mgr,
     FdoSmPhDbObjectP    dbObject
 ) :
-    FdoSmPhRdPkeyReader(MakeReader(mgr,(const FdoSmPhOwner*)(dbObject->GetParent()),dbObject)),
+    FdoSmPhRdPkeyReader((FdoSmPhReader*) NULL),
     mDbObject(dbObject)
 {
+    FdoSmPhOwnerP owner = FDO_SAFE_ADDREF((FdoSmPhOwner*)(FdoSmPhDbElement*)(dbObject->GetParent()));
+
+    FdoStringsP objectNames = FdoStringCollection::Create();
+    objectNames->Add(dbObject->GetName());
+
+    SetSubReader(MakeReader(owner,objectNames));
 }
 
 FdoSmPhRdMySqlPkeyReader::FdoSmPhRdMySqlPkeyReader(
-    FdoSmPhMgrP mgr,
     FdoSmPhOwnerP    owner
 ) :
-    FdoSmPhRdPkeyReader(MakeReader(mgr,(FdoSmPhOwner*) owner, (FdoSmPhDbObject*) NULL))
+    FdoSmPhRdPkeyReader((FdoSmPhReader*) NULL)
 {
+    FdoStringsP objectNames = FdoStringCollection::Create();
+
+    SetSubReader(MakeReader(owner,objectNames));
 }
 
+FdoSmPhRdMySqlPkeyReader::FdoSmPhRdMySqlPkeyReader(
+    FdoSmPhOwnerP owner,
+    FdoStringsP objectNames
+) :
+    FdoSmPhRdPkeyReader((FdoSmPhReader*) NULL)
+{
+    SetSubReader(MakeReader(owner,objectNames));
+}
+
+FdoSmPhRdMySqlPkeyReader::FdoSmPhRdMySqlPkeyReader(
+    FdoSmPhOwnerP owner,
+    FdoSmPhRdTableJoinP join
+) :
+    FdoSmPhRdPkeyReader((FdoSmPhReader*) NULL)
+{
+    FdoStringsP objectNames = FdoStringCollection::Create();
+
+    SetSubReader(MakeReader(owner,objectNames,join));
+}
+
 FdoSmPhRdMySqlPkeyReader::~FdoSmPhRdMySqlPkeyReader(void)
 {
 }
@@ -54,15 +82,45 @@
 }
 
 FdoSmPhReaderP FdoSmPhRdMySqlPkeyReader::MakeReader(
-    FdoSmPhMgrP mgr,
-    const FdoSmPhOwner* owner,
-    FdoSmPhDbObjectP    dbObject
+    FdoSmPhOwnerP owner,
+    FdoStringsP objectNames,
+    FdoSmPhRdTableJoinP join
 )
 {
-    FdoSmPhMySqlOwner* mqlOwner = (FdoSmPhMySqlOwner*) owner;
-    FdoStringP objectName = dbObject ? dbObject->GetName() : L"";
+    FdoSmPhMgrP mgr = owner->GetManager();
+    FdoSmPhMySqlOwnerP mqlOwner = owner->SmartCast<FdoSmPhMySqlOwner>();
     FdoStringP ownerName = owner->GetName();
 
+    // Create binds for owner and optional object names
+
+    FdoSmPhRdDbObjectBindsP binds = new FdoSmPhRdDbObjectBinds(
+        mgr,
+        L"tc.table_schema",
+        L"owner_name",
+        L"tc.table_name",
+        L"table_name",
+        ownerName,
+        objectNames
+    );
+
+    // Generate sql statement
+
+    // If joining to another table, generated from sub-clause for table.
+    FdoStringP joinFrom;
+    if ( join != NULL ) 
+        joinFrom = FdoStringP::Format( L"  , %ls", (FdoString*) join->GetFrom() );
+
+    // Get where clause for owner and object name binds.
+    FdoStringP qualification = binds->GetSQL();
+
+    // Need proper collation to get case-sensitive comparison.
+    qualification = qualification.Replace( L"= ?", L"collate utf8_bin = ?" );
+		
+    if ( join != NULL ) {
+        // If joining to another table, add generated join clause.
+        qualification += FdoStringP::Format( L"  and (%ls)", (FdoString*) join->GetWhere(L"tc.table_name") );
+    }
+
     // Generate SQL statement to get the primary key columns.
     //mysql> desc INFORMATION_SCHEMA.table_constraints;
     //+--------------------+--------------+------+-----+---------+-------+
@@ -100,50 +158,29 @@
     // is case-sensitive. 
 
     FdoStringP sqlString = FdoStringP::Format(
-      L"select tc.constraint_name as constraint_name,\n"
+      L"select %ls tc.constraint_name as constraint_name,\n"
       L" tc.table_name as table_name, kcu.column_name as column_name\n"
-      L" from %ls tc, %ls kcu\n"
+      L" from %ls tc, %ls kcu%ls\n"
       L" where (tc.constraint_schema collate utf8_bin = kcu.constraint_schema\n"
       L"     and tc.constraint_name collate utf8_bin = kcu.constraint_name\n"
       L"     and tc.table_schema collate utf8_bin = kcu.table_schema\n"
       L"     and tc.table_name collate utf8_bin = kcu.table_name\n"
-      L"     and tc.table_schema collate utf8_bin = ?\n"
-      L"     %ls\n"
+      L"     and %ls\n"
       L"     and tc.constraint_type = 'PRIMARY KEY')\n"
       L" order by tc.table_name collate utf8_bin, kcu.ordinal_position",
+      join ? L"distinct" : L"",
       (FdoString*) mqlOwner->GetTableConstraintsTable(),
       (FdoString*) mqlOwner->GetKeyColumnUsageTable(),
-      dbObject ? L"and tc.table_name collate utf8_bin = ?" : L""
+      (FdoString*)joinFrom,
+      (FdoString*) qualification
     );
 
     // Create a field object for each field in the select list.
     FdoSmPhRowsP rows = MakeRows(mgr);
 
-    // Create and set the bind variables
-    FdoSmPhRowP binds = new FdoSmPhRow( mgr, L"Binds" );
-    FdoSmPhDbObjectP rowObj = binds->GetDbObject();
-
-    FdoSmPhFieldP field = new FdoSmPhField(
-        binds,
-        L"owner_name",
-        rowObj->CreateColumnDbObject(L"owner_name",false)
-    );
-
-    field->SetFieldValue(ownerName);
-
-    if ( dbObject ) {
-        field = new FdoSmPhField(
-            binds,
-            L"object_name",
-            rowObj->CreateColumnDbObject(L"object_name",false)
-        );
-
-        field->SetFieldValue(objectName);
-    }
-
 //TODO: cache this query to make full use of the binds.
     FdoSmPhRdGrdQueryReader* reader =
-        new FdoSmPhRdGrdQueryReader( FdoSmPhRowP(rows->GetItem(0)), sqlString, mgr, binds );
+        new FdoSmPhRdGrdQueryReader( FdoSmPhRowP(rows->GetItem(0)), sqlString, mgr, binds->GetBinds() );
 
     return( reader );
 }

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.h	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/PkeyReader.h	2007-02-23 14:42:21 UTC (rev 2607)
@@ -23,28 +23,52 @@
 #endif
 
 #include <Sm/Ph/Rd/PkeyReader.h>
-//#include <Inc/Ocidr/context.h>
+#include <Sm/Ph/Rd/TableJoin.h>
 
 // MySql primary key reader implementation
 
 class FdoSmPhRdMySqlPkeyReader : public FdoSmPhRdPkeyReader
 {
 public:
-    // Create and execute the primary key reader
+    // Create and execute reader for primary keys for a database object.
     //
     // Parameters:
-    //      mgr: Physical Schema Manager
-    //      dbObject: Retrieve primary key columns for this database object.
+    //      dbObject: Retrieve primary key columns for this database object 
+    //      (usually a table).
     FdoSmPhRdMySqlPkeyReader(
-        FdoSmPhMgrP mgr,
-        FdoSmPhDbObjectP    dbObject
+        FdoSmPhDbObjectP dbObject
     );
 
+    // Create and execute reader for all primary keys for a datastore
+    //
+    // Parameters:
+    //      owner: The datastore
     FdoSmPhRdMySqlPkeyReader(
-        FdoSmPhMgrP mgr,
         FdoSmPhOwnerP    owner
     );
 
+    // Create and execute reader for primary keys for list of database objects
+    //
+    // Parameters:
+    //      owner: Owner of the database objects
+    //      objectNames: Retrieve primary key columns for these database objects
+    //      (usually tables).
+    FdoSmPhRdMySqlPkeyReader(
+        FdoSmPhOwnerP   owner,
+        FdoStringsP     objectNames
+    );
+
+    // Create and execute reader for primary keys for a datastore. Limit the primary
+    // keys fetched according to the given join
+    //
+    // Parameters:
+    //      owner: Datastore to retrieve primary keys from.
+    //      join: a join to another tables (typically f_classdefinition).
+    FdoSmPhRdMySqlPkeyReader(
+        FdoSmPhOwnerP   owner,
+        FdoSmPhRdTableJoinP join
+    );
+
     // Deactivates the query.
     ~FdoSmPhRdMySqlPkeyReader(void);
 
@@ -56,9 +80,9 @@
 private:
 
     FdoSmPhReaderP MakeReader(
-        FdoSmPhMgrP mgr,
-        const FdoSmPhOwner* owner,
-        FdoSmPhDbObjectP    dbObject
+        FdoSmPhOwnerP owner,
+        FdoStringsP objectNames,
+        FdoSmPhRdTableJoinP join = (FdoSmPhRdTableJoin *) NULL
     );
 
     FdoSmPhDbObjectP mDbObject;

Modified: trunk/Providers/GenericRdbms/Src/SchemaMgr/Ov/RdbmsOvPropertyMappingRelation.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/SchemaMgr/Ov/RdbmsOvPropertyMappingRelation.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/SchemaMgr/Ov/RdbmsOvPropertyMappingRelation.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -57,7 +57,7 @@
     // class definition. Create a class definition and pass the SAX events to it.
 
     if ( !mClassDefinition )
-        CreateInternalClass( true );
+        FdoRdbmsOvClassP( CreateInternalClass(true) );
 
     if ( mClassDefinition ) 
         mClassDefinition->SetParent(this);

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -343,7 +343,7 @@
 
 void FdoApplySchemaTest::TestOverrides ()
 {
-	FdoPtr<FdoIConnection> connection;
+    FdoPtr<FdoIConnection> connection;
     StaticConnection* staticConn = NULL;
 	
 #ifdef RDBI_DEF_SSQL
@@ -574,6 +574,13 @@
         pDescMappingCmd->SetIncludeDefaults(true);
         mappings = pDescMappingCmd->Execute();
 
+        mgr = NULL;
+        lp = NULL;
+        ph = NULL;
+        staticConn->disconnect();
+        delete staticConn;
+        staticConn = NULL;
+
         printf( "Closing Connection ... \n" );
 		UnitTestUtil::CloseConnection(
 			connection,
@@ -643,20 +650,21 @@
         CreateForeignBasedSchema( 
             connection, 
             pSchema, 
-            CreateForeignBasedOverrides(connection)
+            FdoRdbmsOvSchemaMappingP(CreateForeignBasedOverrides(connection))
         );
 
         printf( "Writing 1st LogicalPhysical Schema ... \n" );
         mgr = staticConn->CreateSchemaManager();
         lp = mgr->RefLogicalPhysicalSchemas();
         lp->XMLSerialize( UnitTestUtil::GetOutputFileName( L"apply_schema_foreign1.xml" ) );
+        ph = mgr->GetPhysicalSchema();
 
         WriteXmlOverrides( 
             connection, 
             false, 
             L"", 
             UnitTestUtil::GetOutputFileName( L"apply_schema_foreign_out1.xml" ),
-            FdoStringP(DB_NAME_OVERRIDE_SUFFIX)
+            ph->GetDcOwnerName(DB_NAME_OVERRIDE_SUFFIX)
         );
 
         WriteXmlOverrides( 
@@ -664,7 +672,7 @@
             true, 
             L"", 
             UnitTestUtil::GetOutputFileName( L"apply_schema_foreign_out2.xml" ),
-            FdoStringP(DB_NAME_OVERRIDE_SUFFIX)
+            ph->GetDcOwnerName(DB_NAME_OVERRIDE_SUFFIX)
         );
 
 
@@ -707,6 +715,13 @@
 	    UnitTestUtil::CheckOutput( "apply_schema_foreign_out2_master.txt", UnitTestUtil::GetOutputFileName( L"apply_schema_foreign_out2.xml" ) );
 #endif
 
+        mgr = NULL;
+        lp = NULL;
+        ph = NULL;
+        staticConn->disconnect();
+        delete staticConn;
+        staticConn = NULL;
+
         printf( "Closing Connection ... \n" );
 		UnitTestUtil::CloseConnection(
 			connection,
@@ -1286,7 +1301,7 @@
 
 void FdoApplySchemaTest::TestConfigDoc ()
 {
-	FdoPtr<FdoIConnection> connection;
+    FdoPtr<FdoIConnection> connection;
     StaticConnection* staticConn = NULL;
     FdoIoMemoryStreamP configStream1 = FdoIoMemoryStream::Create();
     FdoIoMemoryStreamP configStream2 = FdoIoMemoryStream::Create();
@@ -5702,7 +5717,9 @@
         <xsl:apply-templates select=\"@*[not(name()='owner')]\"/>\
         <xsl:if test=\"@owner\">\
             <xsl:attribute name=\"owner\">\
-                <xsl:value-of select=\"concat('(fdo_user_prefix)',substring-after(@owner,substring-before(@owner,$ownerSuffix)))\"/>\
+                <xsl:call-template name=\"tolower\">\
+                    <xsl:with-param name=\"inString\" select=\"concat('(fdo_user_prefix)',substring-after(@owner,substring-before(@owner,$ownerSuffix)))\"/>\
+                </xsl:call-template>\
             </xsl:attribute>\
         </xsl:if>\
         <xsl:apply-templates select=\"node()[not(name()='owner')]\"/>\
@@ -5713,6 +5730,10 @@
     <xsl:apply-templates select=\"@*|node()\"/>\
   </xsl:copy>\
 </xsl:template>\
+<xsl:template name=\"tolower\">\
+  <xsl:param name=\"inString\"/>\
+  <xsl:value-of select=\"translate($inString,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')\"/>\
+</xsl:template>\
 </stylesheet>";
 
   	FdoPtr<FdoIDescribeSchemaMapping>  pDescCmd = (FdoIDescribeSchemaMapping*) connection->CreateCommand(FdoCommandType_DescribeSchemaMapping);

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out1_master.txt
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out1_master.txt	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out1_master.txt	2007-02-23 14:42:21 UTC (rev 2607)
@@ -2,7 +2,7 @@
 <fdo:DataStore xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:fds="http://fdo.osgeo.org/schemas/fds">
 <SchemaMapping xmlns:rdb="http://fdordbms.osgeo.org/schemas" xmlns="http://www.autodesk.com/isd/fdo/OracleProvider" provider="Autodesk.Oracle.3.2" name="ForeignBased">
 <complexType name="OneForeignType">
-<Table owner="fdo_br_apply_override" name="ONEFOREIGN"/>
+<Table owner="FDO_BR_APPLY_OVERRIDE" name="ONEFOREIGN"/>
 </complexType>
 <complexType name="OvClassC111Type">
 <element name="Object-x20-B">

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out2_master.txt
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out2_master.txt	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/apply_schema_foreign_out2_master.txt	2007-02-23 14:42:21 UTC (rev 2607)
@@ -2,7 +2,7 @@
 <fdo:DataStore xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:fds="http://fdo.osgeo.org/schemas/fds">
 <SchemaMapping xmlns:rdb="http://fdordbms.osgeo.org/schemas" xmlns="http://www.autodesk.com/isd/fdo/OracleProvider" provider="Autodesk.Oracle.3.2" name="ForeignBased">
 <complexType name="OneForeignType" tableMapping="Concrete">
-<Table owner="fdo_br_apply_override" name="ONEFOREIGN"/>
+<Table owner="FDO_BR_APPLY_OVERRIDE" name="ONEFOREIGN"/>
 <element name="Data">
 <Column name="DATA"/>
 </element>

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/schemaGenConfig1_master.txt
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/schemaGenConfig1_master.txt	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/schemaGenConfig1_master.txt	2007-02-23 14:42:21 UTC (rev 2607)
@@ -524,6 +524,42 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="GH_VIEW1" type="Schema_GH:GH_VIEW1Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="GH_VIEW1Key">
+<xs:selector xpath=".//GH_VIEW1"/>
+<xs:field xpath="ID"/>
+</xs:key>
+</xs:element>
+<xs:complexType name="GH_VIEW1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:complexContent>
+<xs:extension base="fdo:ClassType">
+<xs:sequence>
+<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="DOUBLE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:double"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
 </xs:schema>
 <xs:schema xmlns:Schema_AB="http://fdo.osgeo.org/schemas/feature/Schema_AB" targetNamespace="http://fdo.osgeo.org/schemas/feature/Schema_AB" elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:annotation>
@@ -751,6 +787,42 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="VIEW1" type="Schema_AB: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="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="DOUBLE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:double"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
 <xs:element name="CD_TABLEWILD" type="Schema_AB:CD_TABLEWILDType" abstract="false" substitutionGroup="gml:_Feature">
 <xs:key name="CD_TABLEWILDKey">
 <xs:selector xpath=".//CD_TABLEWILD"/>
@@ -789,10 +861,18 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="EF_VIEW1" type="Schema_AB:EF_VIEW1Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="EF_VIEW1Key">
+<xs:selector xpath=".//EF_VIEW1"/>
+<xs:field xpath="ID"/>
+</xs:key>
+</xs:element>
 <xs:complexType name="EF_VIEW1Type" abstract="false">
 <xs:annotation>
 <xs:documentation/>
 </xs:annotation>
+<xs:complexContent>
+<xs:extension base="fdo:ClassType">
 <xs:sequence>
 <xs:element name="ID">
 <xs:annotation>
@@ -814,6 +894,8 @@
 </xs:annotation>
 </xs:element>
 </xs:sequence>
+</xs:extension>
+</xs:complexContent>
 </xs:complexType>
 <xs:element name="GH_TABLEWILD" type="Schema_AB:GH_TABLEWILDType" abstract="false" substitutionGroup="gml:_Feature">
 <xs:key name="GH_TABLEWILDKey">
@@ -1184,6 +1266,42 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="CD_VIEW1" type="Schema_CD:CD_VIEW1Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="CD_VIEW1Key">
+<xs:selector xpath=".//CD_VIEW1"/>
+<xs:field xpath="ID"/>
+</xs:key>
+</xs:element>
+<xs:complexType name="CD_VIEW1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:complexContent>
+<xs:extension base="fdo:ClassType">
+<xs:sequence>
+<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="DOUBLE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:double"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
 </xs:schema>
 <xs:schema xmlns:Schema_EF="http://fdo.osgeo.org/schemas/feature/Schema_EF" xmlns:Schema_GH="http://fdo.osgeo.org/schemas/feature/Schema_GH" targetNamespace="http://fdo.osgeo.org/schemas/feature/Schema_EF" elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:annotation>
@@ -1456,6 +1574,42 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="KL_VIEW1" type="Schema_KL:KL_VIEW1Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="KL_VIEW1Key">
+<xs:selector xpath=".//KL_VIEW1"/>
+<xs:field xpath="ID"/>
+</xs:key>
+</xs:element>
+<xs:complexType name="KL_VIEW1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:complexContent>
+<xs:extension base="fdo:ClassType">
+<xs:sequence>
+<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="DOUBLE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:double"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
 <xs:element name="MN_TABLE1" type="Schema_KL:MN_TABLE1Type" abstract="false" substitutionGroup="gml:_Feature">
 <xs:key name="MN_TABLE1Key">
 <xs:selector xpath=".//MN_TABLE1"/>
@@ -1546,6 +1700,42 @@
 </xs:extension>
 </xs:complexContent>
 </xs:complexType>
+<xs:element name="MN_VIEW1" type="Schema_KL:MN_VIEW1Type" abstract="false" substitutionGroup="gml:_Feature">
+<xs:key name="MN_VIEW1Key">
+<xs:selector xpath=".//MN_VIEW1"/>
+<xs:field xpath="ID"/>
+</xs:key>
+</xs:element>
+<xs:complexType name="MN_VIEW1Type" abstract="false">
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+<xs:complexContent>
+<xs:extension base="fdo:ClassType">
+<xs:sequence>
+<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="DOUBLE_COLUMN" minOccurs="0">
+<xs:simpleType>
+<xs:restriction base="xs:double"/>
+</xs:simpleType>
+<xs:annotation>
+<xs:documentation/>
+</xs:annotation>
+</xs:element>
+</xs:sequence>
+</xs:extension>
+</xs:complexContent>
+</xs:complexType>
 </xs:schema>
 <SchemaMapping xmlns="http://www.autodesk.com/isd/fdo/OracleProvider" xmlns:rdb="http://fdordbms.osgeo.org/schemas" provider="Autodesk.Oracle.3.2" name="Schema_GH">
 <complexType name="TABLE5Type">
@@ -1680,6 +1870,15 @@
 <Column name="DOUBLE_COLUMN"/>
 </element>
 </complexType>
+<complexType name="GH_VIEW1Type">
+<Table name="GH_VIEW1"/>
+<element name="ID">
+<Column name="ID"/>
+</element>
+<element name="DOUBLE_COLUMN">
+<Column name="DOUBLE_COLUMN"/>
+</element>
+</complexType>
 </SchemaMapping>
 <SchemaMapping xmlns="http://www.autodesk.com/isd/fdo/OracleProvider" xmlns:rdb="http://fdordbms.osgeo.org/schemas" provider="Autodesk.Oracle.3.2" name="Schema_AB">
 <complexType name="TABLE1Type">
@@ -1736,6 +1935,15 @@
 <Column name="STRING_COLUMN"/>
 </element>
 </complexType>
+<complexType name="VIEW1Type">
+<Table name="AB_VIEW1"/>
+<element name="ID">
+<Column name="ID"/>
+</element>
+<element name="DOUBLE_COLUMN">
+<Column name="DOUBLE_COLUMN"/>
+</element>
+</complexType>
 <complexType name="CD_TABLEWILDType">
 <Table pkeyName="PK_CD_TABLEWILD" name="CD_TABLEWILD"/>
 <element name="ID">
@@ -1825,6 +2033,15 @@
 <Column name="DOUBLE_COLUMN"/>
 </element>
 </complexType>
+<complexType name="CD_VIEW1Type">
+<Table name="CD_VIEW1"/>
+<element name="ID">
+<Column name="ID"/>
+</element>
+<element name="DOUBLE_COLUMN">
+<Column name="DOUBLE_COLUMN"/>
+</element>
+</complexType>
 </SchemaMapping>
 <SchemaMapping xmlns="http://www.autodesk.com/isd/fdo/OracleProvider" xmlns:rdb="http://fdordbms.osgeo.org/schemas" provider="Autodesk.Oracle.3.2" name="Schema_EF">
 <complexType name="TABLE1Type">
@@ -1892,6 +2109,15 @@
 <Column name="STRING_COLUMN"/>
 </element>
 </complexType>
+<complexType name="KL_VIEW1Type">
+<Table name="KL_VIEW1"/>
+<element name="ID">
+<Column name="ID"/>
+</element>
+<element name="DOUBLE_COLUMN">
+<Column name="DOUBLE_COLUMN"/>
+</element>
+</complexType>
 <complexType name="MN_TABLE1Type">
 <Table pkeyName="PK_MN_TABLE1" name="MN_TABLE1"/>
 <element name="ID">
@@ -1916,5 +2142,14 @@
 <Column name="STRING_COLUMN"/>
 </element>
 </complexType>
+<complexType name="MN_VIEW1Type">
+<Table name="MN_VIEW1"/>
+<element name="ID">
+<Column name="ID"/>
+</element>
+<element name="DOUBLE_COLUMN">
+<Column name="DOUBLE_COLUMN"/>
+</element>
+</complexType>
 </SchemaMapping>
 </fdo:DataStore>

Modified: trunk/Utilities/SchemaMgr/Inc/Sm/Ph/Owner.h
===================================================================
--- trunk/Utilities/SchemaMgr/Inc/Sm/Ph/Owner.h	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Utilities/SchemaMgr/Inc/Sm/Ph/Owner.h	2007-02-23 14:42:21 UTC (rev 2607)
@@ -170,6 +170,10 @@
     // Default implementation returns NULL (not supported).
     virtual FdoPtr<FdoSmPhRdPkeyReader> CreatePkeyReader() const;
 
+    // Create a reader to get all primary keys for this join.
+    // Default implementation returns NULL (not supported).
+    virtual FdoPtr<FdoSmPhRdPkeyReader> CreatePkeyReader( FdoPtr<FdoSmPhRdTableJoin> join ) const;
+
     /// Create a reader to get all constraints for this owner and object name list.
     virtual FdoPtr<FdoSmPhRdConstraintReader> CreateConstraintReader( FdoStringsP objectNames, FdoStringP constraintType ) const;
 

Modified: trunk/Utilities/SchemaMgr/Src/Sm/Ph/Mt/ClassReader.cpp
===================================================================
--- trunk/Utilities/SchemaMgr/Src/Sm/Ph/Mt/ClassReader.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Utilities/SchemaMgr/Src/Sm/Ph/Mt/ClassReader.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -20,6 +20,7 @@
 #include <Sm/Ph/DependencyReader.h>
 #include <Sm/Ph/Mt/ClassReader.h>
 #include <Sm/Ph/Rd/ColumnReader.h>
+#include <Sm/Ph/Rd/PkeyReader.h>
 
 FdoSmPhMtClassReader::FdoSmPhMtClassReader( FdoSmPhRowsP froms, FdoStringP schemaName, FdoStringP className, FdoSmPhMgrP mgr ) : 
 	FdoSmPhReader( MakeReader(froms, schemaName, mgr, className) )
@@ -59,6 +60,7 @@
 {
     FdoSmPhOwnerP owner = mgr->GetOwner();
     FdoSmPhRdDbObjectReaderP objReader;
+    FdoSmPhRdPkeyReaderP pkeyReader;
     FdoSmPhRdConstraintReaderP ukeyReader;
     FdoSmPhRdConstraintReaderP ckeyReader;
     FdoSmPhRdColumnReaderP columnReader;
@@ -85,6 +87,7 @@
         // Doing a single query per owner for each component is more efficient than
         // a query per dbObject.
         // The join is used to limit results to those needed for this schema.
+        pkeyReader = owner->CreatePkeyReader( join );
         ukeyReader = owner->CreateConstraintReader( join, L"U" );
         ckeyReader = owner->CreateConstraintReader( join, L"C" );
 
@@ -103,6 +106,9 @@
                 if ( columnReader ) 
                     dbObject->CacheColumns( columnReader );
 
+                if ( pkeyReader ) 
+                    dbObject->CachePkeys( pkeyReader );
+
                 if ( depReader ) 
                     dbObject->CacheDependenciesUp( depReader );
 

Modified: trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp
===================================================================
--- trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -353,6 +353,11 @@
     return (FdoSmPhRdPkeyReader*) NULL;
 }
 
+FdoPtr<FdoSmPhRdPkeyReader> FdoSmPhOwner::CreatePkeyReader( FdoPtr<FdoSmPhRdTableJoin> join ) const
+{
+    return (FdoSmPhRdPkeyReader*) NULL;
+}
+
 FdoPtr<FdoSmPhRdColumnReader> FdoSmPhOwner::CreateColumnReader() const
 {
     return (FdoSmPhRdColumnReader*) NULL;

Modified: trunk/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp
===================================================================
--- trunk/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp	2007-02-22 22:17:01 UTC (rev 2606)
+++ trunk/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp	2007-02-23 14:42:21 UTC (rev 2607)
@@ -186,7 +186,7 @@
 {
     DeleteFile( L"leak_rpt.txt" );
     _CrtSetReportHook( TestCommonMiscUtil::LeakReportHook );
-    _CrtSetBreakAlloc( 15192 );
+    _CrtSetBreakAlloc( 3453788 );
 }
 
 int TestCommonMiscUtil::LeakReportHook( int reportType, char *message, int *returnValue )
@@ -258,6 +258,9 @@
             fprintf( outFp, "\n" );
             fflush( outFp );
         }
+        else {
+            fprintf( outFp, "{%d} %s", allocNum, message );
+        }
     }
 
     fclose(outFp);



More information about the fdo-commits mailing list