コード例 #1
0
        private int DependenciesCount(int tableId, Enums.ObjectType type, Dictionary <int, bool> depencyTracker)
        {
            int  count   = 0;
            bool putItem = false;
            int  relationalTableId;
            List <ISchemaBase> constraints = this.FindNotOwner(tableId, type);

            for (int index = 0; index < constraints.Count; index++)
            {
                ISchemaBase cons = constraints[index];
                if (cons.ObjectType == type)
                {
                    if (type == Enums.ObjectType.Constraint)
                    {
                        relationalTableId = ((Constraint)cons).RelationalTableId;
                        putItem           = (relationalTableId == tableId);
                    }
                }
                if (putItem)
                {
                    if (!depencyTracker.ContainsKey(tableId))
                    {
                        depencyTracker.Add(tableId, true);
                        count += 1 + DependenciesCount(cons.Parent.Id, type, depencyTracker);
                    }
                }
            }
            return(count);
        }
コード例 #2
0
 /// <summary>
 /// Devuelve todos las constraints dependientes de una tabla.
 /// </summary>
 public List <ISchemaBase> FindNotOwner(int tableId, Enums.ObjectType type)
 {
     try
     {
         List <ISchemaBase> cons = new List <ISchemaBase>();
         this.ForEach(dependency =>
         {
             if (dependency.Type == type)
             {
                 ISchemaBase item = (ISchemaBase)Database.Find(dependency.FullName);
                 if (dependency.Type == Enums.ObjectType.Constraint)
                 {
                     if ((dependency.ObjectId == tableId) && (((Constraint)item).Type == Constraint.ConstraintType.ForeignKey))
                     {
                         cons.Add(item);
                     }
                 }
                 else
                 if (dependency.ObjectId == tableId)
                 {
                     cons.Add(item);
                 }
             }
         });
         return(cons);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
ファイル: SchemaBase.cs プロジェクト: pclancy/ODBX
 protected SchemaBase(string nameCharacterOpen, string nameCharacterClose, Enums.ObjectType objectType)
 {
     this.guid = System.Guid.NewGuid().ToString();
     this.type = objectType;
     this.status = Enums.ObjectStatusType.OriginalStatus;
     this.nameCharacterClose = nameCharacterClose;
     this.nameCharacterOpen = nameCharacterOpen;
 }
コード例 #4
0
ファイル: SchemaBase.cs プロジェクト: cmontana88/OpenDBDiff
 protected SchemaBase(string nameCharacterOpen, string nameCharacterClose, Enums.ObjectType objectType)
 {
     this.guid               = System.Guid.NewGuid().ToString();
     this.type               = objectType;
     this.status             = Enums.ObjectStatusType.OriginalStatus;
     this.nameCharacterClose = nameCharacterClose;
     this.nameCharacterOpen  = nameCharacterOpen;
 }
コード例 #5
0
ファイル: SqlAction.cs プロジェクト: facingup/opendbdiff
 public SqlAction(ISchemaBase item)
 {
     if ((item.ObjectType == Enums.ObjectType.Column) || (item.ObjectType == Enums.ObjectType.Index) || (item.ObjectType == Enums.ObjectType.Constraint))
         this.name = item.Name;
     else
         this.name = item.FullName;
     this.action = item.Status;
     this.type = item.ObjectType;
     childs = new List<SqlAction>();
 }
コード例 #6
0
        private static string CreateMasterDataAPIURL(Enums.ObjectType objectType)
        {
            string apiURL = "";

            try
            {
            }
            catch (Exception ex)
            {
            }
            return(apiURL);
        }
コード例 #7
0
        public SqlOptionFilter(IOptionFilter optionFilter)
        {
            Items = new Collection <SqlOptionFilterItem>();
            var options = optionFilter.GetOptions();

            foreach (var key in options.Keys)
            {
                var filter            = options[key];
                Enums.ObjectType type = (Enums.ObjectType)Enum.Parse(typeof(Enums.ObjectType), filter, true);
                Items.Add(new SqlOptionFilterItem(type, key));
            }
        }
コード例 #8
0
 public SqlAction(ISchemaBase item)
 {
     if ((item.ObjectType == Enums.ObjectType.Column) || (item.ObjectType == Enums.ObjectType.Index) || (item.ObjectType == Enums.ObjectType.Constraint))
     {
         this.name = item.Name;
     }
     else
     {
         this.name = item.FullName;
     }
     this.action = item.Status;
     this.type   = item.ObjectType;
     childs      = new List <SqlAction>();
 }
コード例 #9
0
ファイル: Code.cs プロジェクト: ftabangcura/sql-dbdiff
 public Code(ISchemaBase parent, Enums.ObjectType type, Enums.ScripActionType addAction, Enums.ScripActionType dropAction)
     : base(parent, type)
 {
     dependenciesIn  = new List <String>();
     dependenciesOut = new List <String>();
     typeName        = GetObjectTypeName(ObjectType);
     /*Por el momento, solo los Assemblys manejan deep de dependencias*/
     if (this.ObjectType == Enums.ObjectType.Assembly)
     {
         deepMax = 501;
         deepMin = 500;
     }
     this.addAction  = addAction;
     this.dropAction = dropAction;
 }
コード例 #10
0
ファイル: Code.cs プロジェクト: ftabangcura/sql-dbdiff
 private static string GetObjectTypeName(Enums.ObjectType type)
 {
     if (type == Enums.ObjectType.Rule)
     {
         return("RULE");
     }
     if (type == Enums.ObjectType.Trigger)
     {
         return("TRIGGER");
     }
     if (type == Enums.ObjectType.View)
     {
         return("VIEW");
     }
     if (type == Enums.ObjectType.Function)
     {
         return("FUNCTION");
     }
     if (type == Enums.ObjectType.StoreProcedure)
     {
         return("PROCEDURE");
     }
     if (type == Enums.ObjectType.CLRStoreProcedure)
     {
         return("PROCEDURE");
     }
     if (type == Enums.ObjectType.CLRTrigger)
     {
         return("TRIGGER");
     }
     if (type == Enums.ObjectType.CLRFunction)
     {
         return("FUNCTION");
     }
     if (type == Enums.ObjectType.Assembly)
     {
         return("ASSEMBLY");
     }
     return("");
 }
コード例 #11
0
        public static string GenerateTheAPIURL(Enums.ObjectType objectType)
        {
            string apiURL = "";

            switch (objectType)
            {
            case Enums.ObjectType.Events:
                apiURL = CreateEventsAPIURL();
                break;

            case Enums.ObjectType.Users:
                apiURL = CreateMasterDataAPIURL(Enums.ObjectType.Users);
                break;

            case Enums.ObjectType.Sheets:
                apiURL = CreateMasterDataAPIURL(Enums.ObjectType.Sheets);
                break;

            case Enums.ObjectType.Reports:
                apiURL = CreateMasterDataAPIURL(Enums.ObjectType.Reports);
                break;

            case Enums.ObjectType.Sights:
                apiURL = CreateMasterDataAPIURL(Enums.ObjectType.Sights);
                break;

            case Enums.ObjectType.WorkSpaces:
                apiURL = CreateMasterDataAPIURL(Enums.ObjectType.WorkSpaces);
                break;

            case Enums.ObjectType.Groups:
                apiURL = CreateMasterDataAPIURL(Enums.ObjectType.Groups);
                break;
            }
            return(apiURL);
        }
コード例 #12
0
ファイル: Database.cs プロジェクト: biddyweb/opendbiff
        public ISchemaBase Find(String _FullName)
        {
            try
            {
                Enums.ObjectType type       = AllObjects.GetType(_FullName);
                string           parentName = "";

                switch (type)
                {
                case Enums.ObjectType.Table:
                    return(Tables[_FullName]);

                case Enums.ObjectType.StoreProcedure:
                    return(Procedures[_FullName]);

                case Enums.ObjectType.Function:
                    return(Functions[_FullName]);

                case Enums.ObjectType.View:
                    return(Views[_FullName]);

                case Enums.ObjectType.Assembly:
                    return(Assemblies[_FullName]);

                case Enums.ObjectType.UserDataType:
                    return(UserTypes[_FullName]);

                case Enums.ObjectType.TableType:
                    return(TablesTypes[_FullName]);

                case Enums.ObjectType.XMLSchema:
                    return(XmlSchemas[_FullName]);

                case Enums.ObjectType.CLRStoreProcedure:
                    return(CLRProcedures[_FullName]);

                case Enums.ObjectType.CLRFunction:
                    return(CLRFunctions[_FullName]);

                case Enums.ObjectType.Synonym:
                    return(Synonyms[_FullName]);

                case Enums.ObjectType.FullText:
                    return(FullText[_FullName]);

                case Enums.ObjectType.Rule:
                    return(Rules[_FullName]);

                case Enums.ObjectType.PartitionFunction:
                    return(PartitionFunctions[_FullName]);

                case Enums.ObjectType.PartitionScheme:
                    return(PartitionSchemes[_FullName]);

                case Enums.ObjectType.Role:
                    return(Roles[_FullName]);

                case Enums.ObjectType.Schema:
                    return(Schemas[_FullName]);

                case Enums.ObjectType.Constraint:
                    parentName = AllObjects.GetParentName(_FullName);
                    return(Tables[parentName].Constraints[_FullName]);

                case Enums.ObjectType.Index:
                    parentName = AllObjects.GetParentName(_FullName);
                    type       = AllObjects.GetType(parentName);
                    if (type == Enums.ObjectType.Table)
                    {
                        return(Tables[parentName].Indexes[_FullName]);
                    }
                    return(Views[parentName].Indexes[_FullName]);

                case Enums.ObjectType.Trigger:
                    parentName = AllObjects.GetParentName(_FullName);
                    type       = AllObjects.GetType(parentName);
                    if (type == Enums.ObjectType.Table)
                    {
                        return(Tables[parentName].Triggers[_FullName]);
                    }
                    return(Views[parentName].Triggers[_FullName]);

                case Enums.ObjectType.CLRTrigger:
                    parentName = AllObjects.GetParentName(_FullName);
                    type       = AllObjects.GetType(parentName);
                    if (type == Enums.ObjectType.Table)
                    {
                        return(Tables[parentName].CLRTriggers[_FullName]);
                    }
                    return(Views[parentName].CLRTriggers[_FullName]);
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }
コード例 #13
0
        public int DependenciesCount(int objectId, Enums.ObjectType type)
        {
            Dictionary <int, bool> depencyTracker = new Dictionary <int, bool>();

            return(DependenciesCount(objectId, type, depencyTracker));
        }
コード例 #14
0
 public SqlOptionFilterItem(Enums.ObjectType type, string filter)
 {
     this.Filter = filter;
     this.Type   = type;
 }
コード例 #15
0
 public SqlOptionFilterItem(Enums.ObjectType type, string value)
 {
     this.filter = value;
     this.type   = type;
 }
コード例 #16
0
 public ObjectDependency(string name, string Column, Enums.ObjectType type)
 {
     this.Name       = name;
     this.ColumnName = Column;
     this.Type       = type;
 }
コード例 #17
0
 public CLRCode(ISchemaBase parent, Enums.ObjectType type, Enums.ScripActionType addAction, Enums.ScripActionType dropAction)
     : base(parent, type, addAction, dropAction)
 {
 }
コード例 #18
0
 public SqlOptionFilterItem(Enums.ObjectType type, string value)
 {
     this.filter = value;
     this.type = type;
 }
コード例 #19
0
ファイル: ObjectDependency.cs プロジェクト: pclancy/ODBX
 public ObjectDependency(string name, string Column, Enums.ObjectType type)
 {
     this.name = name;
     this.columnName = Column;
     this.type = type;
 }
コード例 #20
0
ファイル: SQLServerSchemaBase.cs プロジェクト: sbane/SQLoogle
 protected SQLServerSchemaBase(ISchemaBase parent, Enums.ObjectType objectType) : base("[", "]", objectType)
 {
     this.Parent        = parent;
     extendedProperties = new SchemaList <ExtendedProperty, ISchemaBase>(parent);
 }