Exemple #1
0
 public void FullAnalysis()
 {
     CheckInput();
     if (Structure != null) throw new Exception("DBSH-00126 Structure must not be filled");
     if (ChangeSet != null) throw new Exception("DBSH-00127 ChangeSet must not be filled");
     Structure = new DatabaseInfo();
     if (FilterOptions == null) FilterOptions = new DatabaseAnalyserFilterOptions();
     DoRunAnalysis();
     SortStructureItems();
 }
        public void IncrementalAnalysis()
        {
            CheckInput();
            if (Structure == null)
            {
                throw new Exception("DBSH-00128 Structure required");
            }
            if (ChangeSet == null)
            {
                throw new Exception("DBSH-00129 ChangeSet required");
            }
            if (FilterOptions != null)
            {
                throw new Exception("DBSH-00130 FilterOptions must not be filled");
            }
            FilterOptions = ChangeSet.CreateFilter();

            foreach (var item in ChangeSet.Items)
            {
                switch (item.Action)
                {
                case DatabaseChangeAction.Remove:
                    Structure.RemoveObjectById(item.ObjectId);
                    break;

                case DatabaseChangeAction.Change:
                    if (item.ObjectType == DatabaseObjectType.Table)
                    {
                        var tbl = Structure.FindObjectById(item.ObjectId) as TableInfo;
                        if (tbl != null)
                        {
                            tbl.Columns.Clear();
                            tbl.ForeignKeys.Clear();
                            tbl.Indexes.Clear();
                            tbl.Uniques.Clear();
                            tbl.Checks.Clear();
                            tbl.PrimaryKey = null;
                            tbl.FullName   = item.NewName;
                        }
                    }
                    else
                    {
                        Structure.RemoveObjectById(item.ObjectId);
                    }
                    break;
                }
            }

            DoRunAnalysis();
            SortStructureItems();
        }
Exemple #3
0
        public DatabaseAnalyserFilterOptions CreateFilter()
        {
            var res = new DatabaseAnalyserFilterOptions();
            res.SetEmptyFilter();

            foreach(var item in Items)
            {
                switch (item.Action)
                {
                    case DatabaseChangeAction.Add:
                    case DatabaseChangeAction.Change:
                        res[item.ObjectType].Add(item.ObjectId);
                        break;
                }
            }

            return res;
        }
 public void FullAnalysis()
 {
     CheckInput();
     if (Structure != null)
     {
         throw new Exception("DBSH-00126 Structure must not be filled");
     }
     if (ChangeSet != null)
     {
         throw new Exception("DBSH-00127 ChangeSet must not be filled");
     }
     Structure = new DatabaseInfo();
     if (FilterOptions == null)
     {
         FilterOptions = new DatabaseAnalyserFilterOptions();
     }
     DoRunAnalysis();
     SortStructureItems();
 }
        public DatabaseAnalyserFilterOptions CreateFilter()
        {
            var res = new DatabaseAnalyserFilterOptions();

            res.SetEmptyFilter();

            foreach (var item in Items)
            {
                switch (item.Action)
                {
                case DatabaseChangeAction.Add:
                case DatabaseChangeAction.Change:
                    res[item.ObjectType].Add(item.ObjectId);
                    break;
                }
            }

            return(res);
        }
Exemple #6
0
        public void IncrementalAnalysis()
        {
            CheckInput();
            if (Structure == null) throw new Exception("DBSH-00128 Structure required");
            if (ChangeSet == null) throw new Exception("DBSH-00129 ChangeSet required");
            if (FilterOptions != null) throw new Exception("DBSH-00130 FilterOptions must not be filled");
            FilterOptions = ChangeSet.CreateFilter();

            foreach (var item in ChangeSet.Items)
            {
                switch (item.Action)
                {
                    case DatabaseChangeAction.Remove:
                        Structure.RemoveObjectById(item.ObjectId);
                        break;
                    case DatabaseChangeAction.Change:
                        if (item.ObjectType == DatabaseObjectType.Table)
                        {
                            var tbl = Structure.FindObjectById(item.ObjectId) as TableInfo;
                            if (tbl != null)
                            {
                                tbl.Columns.Clear();
                                tbl.ForeignKeys.Clear();
                                tbl.Indexes.Clear();
                                tbl.Uniques.Clear();
                                tbl.Checks.Clear();
                                tbl.PrimaryKey = null;
                                tbl.FullName = item.NewName;
                            }
                        }
                        else
                        {
                            Structure.RemoveObjectById(item.ObjectId);
                        }
                        break;
                }
            }

            DoRunAnalysis();
            SortStructureItems();
        }