Esempio n. 1
0
        public static void ImportChildRelations(ITable srcTab, TableDefinitionDataTable destTabs)
        {
            foreach (IForeignKey srcFK in srcTab.ForeignKeys)
            {
                if (srcTab == srcFK.PrimaryTable)   // use only childrelations
                {
                    TableDefinitionRow childTab  = destTabs.FindByTableName(srcFK.ForeignTable.Name);
                    TableDefinitionRow parentTab = destTabs.FindByTableName(srcFK.PrimaryTable.Name);
                    if ((childTab == null) || (parentTab == null))
                    {
                        return; // both tables are not included
                    }
                    String relationName =
                        parentTab.Table.DataSet.RelationDefinition.CreateUniqueRelationName(srcFK.Name, childTab.TableName, parentTab.TableName);

                    RelationDefinitionRow curRelation = parentTab.InsertNewRelation(relationName, childTab.TableName);

                    IColumns parentColums = srcFK.PrimaryColumns;
                    IColumns childColums  = srcFK.ForeignColumns;

                    FieldRelationDefinitionRow curFieldRelation = null;

                    for (int colNo = 0; colNo < parentColums.Count; colNo++)
                    {
                        curFieldRelation = curRelation.InsertNewFieldRelation(parentColums[colNo].Name, childColums[colNo].Name);
                    }
                } // if (srcTab == srcFK.PrimaryTable)   // use only childrelations
            }     // foreach (IForeignKey srcFK in srcTab.ForeignKeys)
        }
Esempio n. 2
0
        public static void ImportRelations(IDatabase srcDb, SchemaXsd3bEx destSet)
        {
            TableDefinitionDataTable destTabs = destSet.TableDefinition;

            foreach (ITable srcTab in srcDb.Tables)
            {
                ImportChildRelations(srcTab, destTabs);
            }
        }
Esempio n. 3
0
        public static void ImportTable(ITable srcTab, TableDefinitionDataTable destTabs)
        {
            TableDefinitionRow destTab = destTabs.FindByTableName(srcTab.Name);

            if (destTab == null)
            {
                destTab           = destTabs.NewTableDefinitionRow();
                destTab.TableName = srcTab.Name;
                destTabs.AddTableDefinitionRow(destTab);
            }
            ImportTable(srcTab, destTab);
        }
Esempio n. 4
0
 public static void ImportProc(IProcedure srcProc, TableDefinitionDataTable destTabs)
 {
     System.Diagnostics.Debug.WriteLine("Import Proc " + srcProc.Name);
     TableDefinitionRow destTab = destTabs.FindByTableName(srcProc.Name);
     if (destTab == null)
     {
         destTab = destTabs.NewTableDefinitionRow();
         destTab.TableName = srcProc.Name;
         destTabs.AddTableDefinitionRow(destTab);
     }
     ImportProc(srcProc, destTab);
 }
Esempio n. 5
0
        public static void ImportProc(IProcedure srcProc, TableDefinitionDataTable destTabs)
        {
            System.Diagnostics.Debug.WriteLine("Import Proc " + srcProc.Name);
            TableDefinitionRow destTab = destTabs.FindByTableName(srcProc.Name);

            if (destTab == null)
            {
                destTab           = destTabs.NewTableDefinitionRow();
                destTab.TableName = srcProc.Name;
                destTabs.AddTableDefinitionRow(destTab);
            }
            ImportProc(srcProc, destTab);
        }
Esempio n. 6
0
        public static void ImportView(IView srcView, TableDefinitionDataTable destTabs)
        {
            System.Diagnostics.Debug.WriteLine("Import View " + srcView.Name);
            TableDefinitionRow destTab = destTabs.FindByTableName(srcView.Name);

            if (destTab == null)
            {
                destTab           = destTabs.NewTableDefinitionRow();
                destTab.TableName = srcView.Name;
                destTabs.AddTableDefinitionRow(destTab);
            }
            ImportView(srcView, destTab);
        }
Esempio n. 7
0
        public static void ImportChildRelations(ITable srcTab, TableDefinitionDataTable destTabs)
        {
            foreach (IForeignKey srcFK in srcTab.ForeignKeys)
            {
                if (srcTab == srcFK.PrimaryTable)   // use only childrelations
                {
                    TableDefinitionRow childTab = destTabs.FindByTableName(srcFK.ForeignTable.Name);
                    TableDefinitionRow parentTab = destTabs.FindByTableName(srcFK.PrimaryTable.Name);
                    if ((childTab == null) || (parentTab == null))
                        return; // both tables are not included

                    String relationName =
                    parentTab.Table.DataSet.RelationDefinition.CreateUniqueRelationName(srcFK.Name, childTab.TableName, parentTab.TableName);

                    RelationDefinitionRow curRelation = parentTab.InsertNewRelation(relationName, childTab.TableName);

                    IColumns parentColums = srcFK.PrimaryColumns;
                    IColumns childColums = srcFK.ForeignColumns;

                    FieldRelationDefinitionRow curFieldRelation = null;

                    for (int colNo = 0; colNo < parentColums.Count; colNo++)
                    {
                        curFieldRelation = curRelation.InsertNewFieldRelation(parentColums[colNo].Name, childColums[colNo].Name);
                    }
                } // if (srcTab == srcFK.PrimaryTable)   // use only childrelations
            } // foreach (IForeignKey srcFK in srcTab.ForeignKeys)

        }
Esempio n. 8
0
 public static void ImportTable(ITable srcTab, TableDefinitionDataTable destTabs)
 {
     TableDefinitionRow destTab = destTabs.FindByTableName(srcTab.Name);
     if (destTab == null)
     {
         destTab = destTabs.NewTableDefinitionRow();
         destTab.TableName = srcTab.Name;
         destTabs.AddTableDefinitionRow(destTab);
     }
     ImportTable(srcTab, destTab);
 }
Esempio n. 9
0
 public static void ImportView(IView srcView, TableDefinitionDataTable destTabs)
 {
     System.Diagnostics.Debug.WriteLine("Import View " + srcView.Name);
     TableDefinitionRow destTab = destTabs.FindByTableName(srcView.Name);
     if (destTab == null)
     {
         destTab = destTabs.NewTableDefinitionRow();
         destTab.TableName = srcView.Name;
         destTabs.AddTableDefinitionRow(destTab);
     }
     ImportView(srcView, destTab);
 }