コード例 #1
0
        public bool DBSyncCompareTO(SProcedure spp)
        {
            ComparatorOfSQL s    = new ComparatorOfSQL(this.sqlText, spp.sqlText);
            bool            ress = true;

            if (this.NazovProcedury != spp.NazovProcedury)
            {
                ress = false;
            }
            if (s.IsDifferent)
            {
                ress = false;
            }
            if (!porovnajPrivileges(privieges, spp.Privieges))
            {
                ress = false;
            }
            return(ress);
        }
コード例 #2
0
        public bool DBSyncCompareTO(Trigger trg)
        {
            ComparatorOfSQL s    = new ComparatorOfSQL(this.sqlText, trg.sqlText);
            bool            ress = true;

            if (this.Disabled != trg.Disabled)
            {
                ress = false;
            }
            if (this.IsAfter != trg.IsAfter)
            {
                ress = false;
            }
            if (this.IsInsteadOf != trg.IsInsteadOf)
            {
                ress = false;
            }
            if (this.OnAction != trg.OnAction)
            {
                ress = false;
            }
            if (s.IsDifferent)
            {
                ress = false;
            }
            if (this.Table_name != trg.Table_name)
            {
                ress = false;
            }
            if (this.Trigger_name != trg.Trigger_name)
            {
                ress = false;
            }
            if (this.Trigger_owner != trg.Trigger_owner)
            {
                ress = false;
            }
            return(ress);
        }
コード例 #3
0
        public bool DBSyncCompareTO(SFunction sf)
        {
            ComparatorOfSQL s    = new ComparatorOfSQL(this.sqlText, sf.sqlText);
            bool            ress = true;

            if (this.NazovFunkcie != sf.NazovFunkcie)
            {
                ress = false;
            }
            if (this.ReturnType != sf.ReturnType)
            {
                ress = false;
            }
            if (s.IsDifferent)
            {
                ress = false;
            }
            if (!porovnajPrivileges(this.Privileges, sf.Privileges))
            {
                ress = false;
            }
            return(ress);
        }
コード例 #4
0
        public DbSyncFunctionDiff(SFunction functionAin, SFunction functionBin)
        {
            this.functionA = functionAin;
            this.functionB = functionBin;

            functionAtributesA = new List <ObjectAtribute>();
            functionAtributesB = new List <ObjectAtribute>();

            privilegeDiffList = new List <DbSyncPrivilegeDiff>();

            grantsMissingDb1 = new List <Privilege>();
            grantsMissingDb2 = new List <Privilege>();
            grantsDifferent  = new List <DbSyncPrivilegeDiff>();

            fulfillLists();

            ComparatorOfSQL compSQL;

            if (functionA == null || functionB == null)
            {
                if (functionA != null)
                {
                    functionName = functionA.NazovFunkcie;
                    functionAtributesA.Add(new ObjectAtribute("Name of function ", functionName, true));
                    functionAtributesA.Add(new ObjectAtribute("Sql text ", "Click button", true, true));
                    functionAtributesA.Add(new ObjectAtribute("Return type ", functionA.ReturnType, true));
                    compSQL      = new ComparatorOfSQL(functionA.SqlText, null);
                    sqlTextListA = compSQL.TextA;
                    sqlTextListB = null;
                }
                if (functionB != null)
                {
                    functionName = functionB.NazovFunkcie;
                    functionAtributesB.Add(new ObjectAtribute("Name of function ", functionName, true));
                    functionAtributesB.Add(new ObjectAtribute("Sql text ", "Click button", true, true));
                    functionAtributesB.Add(new ObjectAtribute("Return type ", functionB.ReturnType, true));
                    compSQL      = new ComparatorOfSQL(null, functionB.SqlText);
                    sqlTextListA = null;
                    sqlTextListB = compSQL.TextA;
                }
                else
                {
                    functionName = "UNDEFINED";
                }
            }
            if (functionA != null && functionB != null)
            {
                compSQL      = new ComparatorOfSQL(functionA.SqlText, functionB.SqlText);
                sqlTextListA = compSQL.TextA;
                sqlTextListB = compSQL.TextB;

                if (functionA.NazovFunkcie != functionB.NazovFunkcie)
                {
                    diffNAmeOfFunction = true;
                }
                if (functionA.ReturnType != functionB.ReturnType)
                {
                    diffReturnType = true;
                }
                if (compSQL.IsDifferent)
                {
                    diffSqlText = true;
                }
                if (!ComparePrivileges(functionA.Privileges, functionB.Privileges))
                {
                    diffPrivileges = true;
                }

                if (diffNAmeOfFunction || diffPrivileges || diffReturnType || diffSqlText)
                {
                    different = true;
                }
                else
                {
                    different = false;
                }

                //vytvorim privileges
                foreach (Privilege privA in functionA.Privileges)
                {
                    bool found = false;
                    foreach (Privilege privB in functionB.Privileges)
                    {
                        if (privA.DBSyncCompareTO(privB))
                        {
                            found = true;
                            privilegeDiffList.Add(new DbSyncPrivilegeDiff(privA, privB));
                        }
                    }
                    if (!found)
                    {
                        privilegeDiffList.Add(new DbSyncPrivilegeDiff(privA, null));
                    }
                }
                foreach (Privilege privB in functionB.Privileges)
                {
                    bool found = false;
                    foreach (DbSyncPrivilegeDiff priv in privilegeDiffList)
                    {
                        if (privB.getName() == priv.getName())
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        this.privilegeDiffList.Add(new DbSyncPrivilegeDiff(null, privB));
                    }
                }

                functionName = functionA.NazovFunkcie;
                functionAtributesA.Add(new ObjectAtribute("Name of function ", functionName, false));
                functionAtributesB.Add(new ObjectAtribute("Name of function ", functionName, false));

                if (diffSqlText)
                {
                    ObjectAtribute sqlA = new ObjectAtribute("Sql text ", "Click button", true, true);
                    functionAtributesA.Add(sqlA);
                    ObjectAtribute sqlB = new ObjectAtribute("Sql text  ", "Click button", true, true);
                    functionAtributesB.Add(sqlB);
                }
                else
                {
                    ObjectAtribute sql = new ObjectAtribute("Sql text  ", "Click button", false, true);
                    functionAtributesA.Add(sql);
                    functionAtributesB.Add(sql);
                }

                if (diffReturnType)
                {
                    ObjectAtribute sqlA = new ObjectAtribute("Return type ", functionA.ReturnType, true);
                    functionAtributesA.Add(sqlA);
                    ObjectAtribute sqlB = new ObjectAtribute("Return type  ", functionB.ReturnType, true);
                    functionAtributesB.Add(sqlB);
                }
                else
                {
                    ObjectAtribute sql = new ObjectAtribute("Return type  ", functionA.ReturnType, false);
                    functionAtributesA.Add(sql);
                    functionAtributesB.Add(sql);
                }
            }
            else
            {
                different = true;
            }
        }
        public DbSyncStoredProcedureDiff(SProcedure procAin, SProcedure procBin)
        {
            this.procA = procAin;
            this.procB = procBin;

            storedProcDiffListA = new List <ObjectAtribute>();
            storedProcDiffListB = new List <ObjectAtribute>();
            privilegeDifList    = new List <DbSyncPrivilegeDiff>();

            grantsMissingDb1 = new List <Privilege>();
            grantsMissingDb2 = new List <Privilege>();
            grantsDifferent  = new List <DbSyncPrivilegeDiff>();

            fulfillLists();

            ComparatorOfSQL compSQL;

            if (procA == null || procB == null)
            {
                if (procA != null)
                {
                    procedureName = procA.NazovProcedury;
                    storedProcDiffListA.Add(new ObjectAtribute("Procedure name", procedureName, false));
                    storedProcDiffListA.Add(new ObjectAtribute("Sql text ", "Click button", false, true));
                    compSQL      = new ComparatorOfSQL(procA.SqlText, null);
                    sqlTextListA = compSQL.TextA;
                    sqlTextListB = null;
                }
                else if (procB != null)
                {
                    procedureName = procB.NazovProcedury;
                    storedProcDiffListB.Add(new ObjectAtribute("Procedure name", procedureName, false));
                    storedProcDiffListB.Add(new ObjectAtribute("Sql text ", "Click button", false, true));
                    compSQL      = new ComparatorOfSQL(null, procB.SqlText);
                    sqlTextListA = null;
                    sqlTextListB = compSQL.TextB;
                }
                else
                {
                    procedureName = "UNDEFINED";
                }
            }
            if (procA != null && procB != null)
            {
                compSQL      = new ComparatorOfSQL(procA.SqlText, procB.SqlText);
                sqlTextListA = compSQL.TextA;
                sqlTextListB = compSQL.TextB;

                procedureName = procB.NazovProcedury;
                storedProcDiffListA.Add(new ObjectAtribute("Procedure name", procedureName, false));
                storedProcDiffListB.Add(new ObjectAtribute("Procedure name", procedureName, false));

                if (procA.NazovProcedury != procB.NazovProcedury)
                {
                    diffNameOfProcedure = true;
                }
                if (compSQL.IsDifferent)
                {
                    diffSqlText = true;
                }
                if (!ComparePrivileges(procA.Privieges, procB.Privieges))
                {
                    diffPrivileges = true;
                }

                if (diffNameOfProcedure || diffPrivileges || diffSqlText)
                {
                    different = true;
                }
                else
                {
                    different = false;
                }

                //vytvorim privileges
                foreach (Privilege privA in procA.Privieges)
                {
                    bool found = false;
                    foreach (Privilege privB in procB.Privieges)
                    {
                        if (privA.DBSyncCompareTO(privB))
                        {
                            found = true;
                            this.privilegeDifList.Add(new DbSyncPrivilegeDiff(privA, privB));
                        }
                    }
                    if (!found)
                    {
                        this.privilegeDifList.Add(new DbSyncPrivilegeDiff(privA, null));
                    }
                }
                foreach (Privilege privB in procB.Privieges)
                {
                    bool found = false;
                    foreach (DbSyncPrivilegeDiff priv in privilegeDifList)
                    {
                        if (privB.getName() == priv.getName())
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        this.privilegeDifList.Add(new DbSyncPrivilegeDiff(null, privB));
                    }
                }

                if (diffSqlText)
                {
                    ObjectAtribute sqlA = new ObjectAtribute("Sql text ", "Click button", true, true);
                    storedProcDiffListA.Add(sqlA);
                    ObjectAtribute sqlB = new ObjectAtribute("Sql text  ", "Click button", true, true);
                    storedProcDiffListB.Add(sqlB);
                }
                else
                {
                    ObjectAtribute sql = new ObjectAtribute("Sql text  ", "Click button", false, true);
                    storedProcDiffListA.Add(sql);
                    storedProcDiffListB.Add(sql);
                }
            }
            else
            {
                different = true;
            }
        }
コード例 #6
0
        public DbSyncFunctionDiff(SFunction functionAin, SFunction functionBin)
        {
            this.functionA = functionAin;
            this.functionB = functionBin;

            functionAtributesA = new List<ObjectAtribute>();
            functionAtributesB = new List<ObjectAtribute>();

            privilegeDiffList = new List<DbSyncPrivilegeDiff>();

            grantsMissingDb1 = new List<Privilege>();
            grantsMissingDb2 = new List<Privilege>();
            grantsDifferent = new List<DbSyncPrivilegeDiff>();

            fulfillLists();

            ComparatorOfSQL compSQL;

            if (functionA == null || functionB == null)
            {
                if (functionA != null)
                {
                    functionName = functionA.NazovFunkcie;
                    functionAtributesA.Add(new ObjectAtribute("Name of function ",functionName, true));
                    functionAtributesA.Add(new ObjectAtribute("Sql text ", "Click button", true,true));
                    functionAtributesA.Add(new ObjectAtribute("Return type ", functionA.ReturnType, true));
                    compSQL = new ComparatorOfSQL(functionA.SqlText, null);
                    sqlTextListA = compSQL.TextA;
                    sqlTextListB = null;
                }
                if (functionB != null)
                {
                    functionName = functionB.NazovFunkcie;
                    functionAtributesB.Add(new ObjectAtribute("Name of function ", functionName, true));
                    functionAtributesB.Add(new ObjectAtribute("Sql text ", "Click button", true, true));
                    functionAtributesB.Add(new ObjectAtribute("Return type ", functionB.ReturnType, true));
                    compSQL = new ComparatorOfSQL(null, functionB.SqlText);
                    sqlTextListA = null;
                    sqlTextListB = compSQL.TextA;
                }
                else functionName = "UNDEFINED";

            }
            if (functionA != null && functionB != null)
            {
                compSQL = new ComparatorOfSQL(functionA.SqlText, functionB.SqlText);
                sqlTextListA = compSQL.TextA;
                sqlTextListB = compSQL.TextB;

                if (functionA.NazovFunkcie != functionB.NazovFunkcie) diffNAmeOfFunction = true;
                if (functionA.ReturnType != functionB.ReturnType) diffReturnType = true;
                if (compSQL.IsDifferent) diffSqlText = true;
                if (!ComparePrivileges(functionA.Privileges, functionB.Privileges)) diffPrivileges = true;

                if (diffNAmeOfFunction || diffPrivileges || diffReturnType || diffSqlText) different = true;
                else different = false;

                //vytvorim privileges
                foreach (Privilege privA in functionA.Privileges)
                {
                    bool found = false;
                    foreach (Privilege privB in functionB.Privileges)
                    {
                        if (privA.DBSyncCompareTO(privB))
                        {
                            found = true;
                            privilegeDiffList.Add(new DbSyncPrivilegeDiff(privA, privB));
                        }

                    }
                    if (!found) privilegeDiffList.Add(new DbSyncPrivilegeDiff(privA, null));
                }
                foreach (Privilege privB in functionB.Privileges)
                {
                    bool found = false;
                    foreach (DbSyncPrivilegeDiff priv in privilegeDiffList)
                    {
                        if (privB.getName() == priv.getName())
                        {
                            found = true;
                        }
                    }
                    if (!found) this.privilegeDiffList.Add(new DbSyncPrivilegeDiff(null, privB));
                }

                functionName = functionA.NazovFunkcie;
                functionAtributesA.Add(new ObjectAtribute("Name of function ", functionName, false));
                functionAtributesB.Add(new ObjectAtribute("Name of function ", functionName, false));

                if (diffSqlText)
                {
                    ObjectAtribute sqlA = new ObjectAtribute("Sql text ", "Click button", true, true);
                    functionAtributesA.Add(sqlA);
                    ObjectAtribute sqlB = new ObjectAtribute("Sql text  ", "Click button", true, true);
                    functionAtributesB.Add(sqlB);
                }
                else
                {
                    ObjectAtribute sql = new ObjectAtribute("Sql text  ", "Click button", false, true);
                    functionAtributesA.Add(sql);
                    functionAtributesB.Add(sql);
                }

                if (diffReturnType)
                {
                    ObjectAtribute sqlA = new ObjectAtribute("Return type ", functionA.ReturnType, true);
                    functionAtributesA.Add(sqlA);
                    ObjectAtribute sqlB = new ObjectAtribute("Return type  ", functionB.ReturnType, true);
                    functionAtributesB.Add(sqlB);
                }
                else
                {
                    ObjectAtribute sql = new ObjectAtribute("Return type  ", functionA.ReturnType, false);
                    functionAtributesA.Add(sql);
                    functionAtributesB.Add(sql);
                }

            }
            else different = true;
        }
コード例 #7
0
        public DbSyncStoredProcedureDiff(SProcedure procAin, SProcedure procBin)
        {
            this.procA = procAin;
            this.procB = procBin;

            storedProcDiffListA = new List<ObjectAtribute>();
            storedProcDiffListB = new List<ObjectAtribute>();
            privilegeDifList = new List<DbSyncPrivilegeDiff>();

            grantsMissingDb1 = new List<Privilege>();
            grantsMissingDb2 = new List<Privilege>();
            grantsDifferent = new List<DbSyncPrivilegeDiff>();

            fulfillLists();

            ComparatorOfSQL compSQL;

            if (procA == null || procB == null)
            {
                if (procA != null)
                {
                    procedureName = procA.NazovProcedury;
                    storedProcDiffListA.Add(new ObjectAtribute("Procedure name", procedureName, false));
                    storedProcDiffListA.Add(new ObjectAtribute("Sql text ", "Click button", false, true));
                    compSQL = new ComparatorOfSQL(procA.SqlText, null);
                    sqlTextListA = compSQL.TextA;
                    sqlTextListB = null;
                }
                else if (procB != null)
                {
                    procedureName = procB.NazovProcedury;
                    storedProcDiffListB.Add(new ObjectAtribute("Procedure name", procedureName, false));
                    storedProcDiffListB.Add(new ObjectAtribute("Sql text ", "Click button", false, true));
                    compSQL = new ComparatorOfSQL(null, procB.SqlText);
                    sqlTextListA = null;
                    sqlTextListB = compSQL.TextB;
                }
                else procedureName = "UNDEFINED";
            }
            if (procA != null && procB != null)
            {
                compSQL = new ComparatorOfSQL(procA.SqlText, procB.SqlText);
                sqlTextListA = compSQL.TextA;
                sqlTextListB = compSQL.TextB;

                procedureName = procB.NazovProcedury;
                storedProcDiffListA.Add(new ObjectAtribute("Procedure name", procedureName,false));
                storedProcDiffListB.Add(new ObjectAtribute("Procedure name", procedureName,false));

                if (procA.NazovProcedury != procB.NazovProcedury) diffNameOfProcedure = true;
                if (compSQL.IsDifferent) diffSqlText = true;
                if (!ComparePrivileges(procA.Privieges, procB.Privieges)) diffPrivileges = true;

                if (diffNameOfProcedure || diffPrivileges || diffSqlText) different = true;
                else different = false;

                //vytvorim privileges
                foreach (Privilege privA in procA.Privieges)
                {
                    bool found = false;
                    foreach (Privilege privB in procB.Privieges)
                    {
                        if (privA.DBSyncCompareTO(privB))
                        {
                            found = true;
                            this.privilegeDifList.Add(new DbSyncPrivilegeDiff(privA, privB));
                        }

                    }
                    if (!found) this.privilegeDifList.Add(new DbSyncPrivilegeDiff(privA, null));
                }
                foreach (Privilege privB in procB.Privieges)
                {
                    bool found = false;
                    foreach (DbSyncPrivilegeDiff priv in privilegeDifList)
                    {
                        if (privB.getName() == priv.getName())
                        {
                            found = true;
                        }
                    }
                    if (!found) this.privilegeDifList.Add(new DbSyncPrivilegeDiff(null, privB));
                }

                if (diffSqlText)
                {
                    ObjectAtribute sqlA = new ObjectAtribute("Sql text ", "Click button", true, true);
                    storedProcDiffListA.Add(sqlA);
                    ObjectAtribute sqlB = new ObjectAtribute("Sql text  ", "Click button", true, true);
                    storedProcDiffListB.Add(sqlB);
                }
                else
                {
                    ObjectAtribute sql = new ObjectAtribute("Sql text  ", "Click button", false, true);
                    storedProcDiffListA.Add(sql);
                    storedProcDiffListB.Add(sql);
                }

            }
            else different = true;
        }
コード例 #8
0
        public DbSyncTriggerDiff(Trigger trigAin, Trigger trigBin)
        {
            this.trigA = trigAin;
            this.trigB = trigBin;

            triggerAtrListA = new List <ObjectAtribute>();
            triggerAtrListB = new List <ObjectAtribute>();

            ComparatorOfSQL compSQL;



            if (trigA == null || trigB == null)
            {
                if (trigA != null)
                {
                    triggerName = trigA.Trigger_name;
                    triggerAtrListA.Add(new ObjectAtribute("Trigger name ", trigA.Trigger_name, true));
                    triggerAtrListA.Add(new ObjectAtribute("sql text  ", "Click button", true, true));
                    triggerAtrListA.Add(new ObjectAtribute("Disabled ", trigA.Disabled.ToString(), true));
                    triggerAtrListA.Add(new ObjectAtribute("Is after  ", trigA.IsAfter.ToString(), true));
                    triggerAtrListA.Add(new ObjectAtribute("Is instead  ", trigA.IsInsteadOf.ToString(), true));
                    triggerAtrListA.Add(new ObjectAtribute("On action  ", trigA.OnAction, true));
                    triggerAtrListA.Add(new ObjectAtribute("Trigger name  ", trigA.Trigger_name, true));
                    triggerAtrListA.Add(new ObjectAtribute("Trigger owner  ", trigA.Trigger_owner, true));
                    compSQL      = new ComparatorOfSQL(trigA.SqlText, null);
                    sqlTextListA = compSQL.TextA;
                    sqlTextListB = null;
                }
                else if (trigB != null)
                {
                    triggerName = trigB.Trigger_name;
                    triggerAtrListB.Add(new ObjectAtribute("Trigger name ", trigB.Trigger_name, true));
                    triggerAtrListB.Add(new ObjectAtribute("sql text  ", "Click button", true, true));
                    triggerAtrListB.Add(new ObjectAtribute("Disabled ", trigB.Disabled.ToString(), true));
                    triggerAtrListB.Add(new ObjectAtribute("Is after  ", trigB.IsAfter.ToString(), true));
                    triggerAtrListB.Add(new ObjectAtribute("Is instead  ", trigB.IsInsteadOf.ToString(), true));
                    triggerAtrListB.Add(new ObjectAtribute("On action  ", trigB.OnAction, true));
                    triggerAtrListB.Add(new ObjectAtribute("Trigger name  ", trigB.Trigger_name, true));
                    triggerAtrListB.Add(new ObjectAtribute("Trigger owner  ", trigB.Trigger_owner, true));
                    compSQL      = new ComparatorOfSQL(null, trigB.SqlText);
                    sqlTextListA = null;
                    sqlTextListB = compSQL.TextB;
                }
                else
                {
                    triggerName = "UNDEFINED";
                }
            }
            if (trigA != null && trigB != null)
            {
                compSQL      = new ComparatorOfSQL(trigA.SqlText, trigB.SqlText);
                sqlTextListA = compSQL.TextA;
                sqlTextListB = compSQL.TextB;

                triggerName = trigA.Trigger_name;
                if (trigA.Disabled != trigB.Disabled)
                {
                    diffDisabled = true;
                }
                if (trigA.IsAfter != trigB.IsAfter)
                {
                    diffIsAfter = true;
                }
                if (trigA.IsInsteadOf != trigB.IsInsteadOf)
                {
                    diffIsInstead = true;
                }
                if (trigA.OnAction != trigB.OnAction)
                {
                    diffOnAction = true;
                }
                if (compSQL.IsDifferent)
                {
                    diffsqltext = true;
                }
                if (trigA.Table_name != trigB.Table_name)
                {
                    diffTableName = true;
                }
                if (trigA.Trigger_name != trigB.Trigger_name)
                {
                    diffTrigName = true;
                }
                if (trigA.Trigger_owner != trigB.Trigger_owner)
                {
                    diffTRigOwner = true;
                }
                if (diffDisabled || diffIsAfter || diffIsInstead || diffOnAction || diffsqltext || diffTableName || diffTrigName || diffTRigOwner)
                {
                    different = true;
                }
                else
                {
                    different = false;
                }

                ObjectAtribute oatriggerName = new ObjectAtribute("Trigger name ", this.triggerName, false);

                triggerAtrListA.Add(oatriggerName);
                triggerAtrListB.Add(oatriggerName);

                if (diffsqltext)
                {
                    ObjectAtribute tSqlTextA = new ObjectAtribute("sql text ", "Click button", true, true);
                    triggerAtrListA.Add(tSqlTextA);

                    ObjectAtribute tSqlTextB = new ObjectAtribute("sql text ", "Click button", true, true);
                    triggerAtrListB.Add(tSqlTextB);
                }
                else
                {
                    ObjectAtribute tSqlText = new ObjectAtribute("sql text ", "Click button", false, true);
                    triggerAtrListA.Add(tSqlText);
                    triggerAtrListB.Add(tSqlText);
                }

                if (diffDisabled)
                {
                    ObjectAtribute tDisabledA = new ObjectAtribute("Disabled ", trigA.Disabled.ToString(), true);
                    triggerAtrListA.Add(tDisabledA);
                    ObjectAtribute tDisabledB = new ObjectAtribute("Disabled ", trigB.Disabled.ToString(), true);
                    triggerAtrListB.Add(tDisabledB);
                }
                else
                {
                    ObjectAtribute tDisabled = new ObjectAtribute("Disabled ", trigB.Disabled.ToString(), false);
                    triggerAtrListA.Add(tDisabled);
                    triggerAtrListB.Add(tDisabled);
                }

                if (diffIsAfter)
                {
                    ObjectAtribute tIsAfterA = new ObjectAtribute("Is after ", trigA.IsAfter.ToString(), true);
                    triggerAtrListA.Add(tIsAfterA);
                    ObjectAtribute tIsAfterB = new ObjectAtribute("Is after ", trigB.IsAfter.ToString(), true);
                    triggerAtrListB.Add(tIsAfterB);
                }
                else
                {
                    ObjectAtribute tIsAfter = new ObjectAtribute("Is after ", trigB.IsAfter.ToString(), false);
                    triggerAtrListA.Add(tIsAfter);
                    triggerAtrListB.Add(tIsAfter);
                }

                if (diffIsInstead)
                {
                    ObjectAtribute tIsInsteadA = new ObjectAtribute("Is instead ", trigA.IsInsteadOf.ToString(), true);
                    triggerAtrListA.Add(tIsInsteadA);
                    ObjectAtribute tIsInsteadB = new ObjectAtribute("Is instead ", trigB.IsInsteadOf.ToString(), true);
                    triggerAtrListB.Add(tIsInsteadB);
                }
                else
                {
                    ObjectAtribute tIsInstead = new ObjectAtribute("Is instead ", trigB.IsInsteadOf.ToString(), false);
                    triggerAtrListA.Add(tIsInstead);
                    triggerAtrListB.Add(tIsInstead);
                }

                if (diffOnAction)
                {
                    ObjectAtribute tOnActionA = new ObjectAtribute("On action ", trigA.OnAction, true);
                    triggerAtrListA.Add(tOnActionA);
                    ObjectAtribute tOnActionB = new ObjectAtribute("On action ", trigB.OnAction, true);
                    triggerAtrListB.Add(tOnActionB);
                }
                else
                {
                    ObjectAtribute tIsInstead = new ObjectAtribute("On action ", trigB.OnAction, false);
                    triggerAtrListA.Add(tIsInstead);
                    triggerAtrListB.Add(tIsInstead);
                }



                if (diffTrigName)
                {
                    ObjectAtribute ttrigNameA = new ObjectAtribute("Trigger name ", trigA.Trigger_name, true);
                    triggerAtrListA.Add(ttrigNameA);
                    ObjectAtribute ttrigNameB = new ObjectAtribute("Trigger name ", trigB.Trigger_name, true);
                    triggerAtrListB.Add(ttrigNameB);
                }
                else
                {
                    ObjectAtribute ttrigName = new ObjectAtribute("Trigger name ", trigB.Trigger_name, false);
                    triggerAtrListA.Add(ttrigName);
                    triggerAtrListB.Add(ttrigName);
                }

                if (diffTRigOwner)
                {
                    ObjectAtribute ttrigOwnerA = new ObjectAtribute("Trigger owner ", trigA.Trigger_owner, true);
                    triggerAtrListA.Add(ttrigOwnerA);
                    ObjectAtribute ttrigOwnerB = new ObjectAtribute("Trigger owner ", trigB.Trigger_owner, true);
                    triggerAtrListB.Add(ttrigOwnerB);
                }
                else
                {
                    ObjectAtribute ttrigOwner = new ObjectAtribute("Trigger owner ", trigB.Trigger_owner, false);
                    triggerAtrListA.Add(ttrigOwner);
                    triggerAtrListB.Add(ttrigOwner);
                }
            }
            else
            {
                different = true;
            }
        }
コード例 #9
0
        public DbSyncTriggerDiff(Trigger trigAin, Trigger trigBin)
        {
            this.trigA = trigAin;
            this.trigB = trigBin;

            triggerAtrListA = new List<ObjectAtribute>();
            triggerAtrListB = new List<ObjectAtribute>();

            ComparatorOfSQL compSQL;

            if (trigA == null || trigB == null)
            {
                if (trigA != null)
                {
                    triggerName = trigA.Trigger_name;
                    triggerAtrListA.Add(new ObjectAtribute("Trigger name ", trigA.Trigger_name, true));
                    triggerAtrListA.Add(new ObjectAtribute("sql text  ", "Click button", true, true));
                    triggerAtrListA.Add(new ObjectAtribute("Disabled ", trigA.Disabled.ToString(), true));
                    triggerAtrListA.Add(new ObjectAtribute("Is after  ", trigA.IsAfter.ToString(), true));
                    triggerAtrListA.Add(new ObjectAtribute("Is instead  ", trigA.IsInsteadOf.ToString(), true));
                    triggerAtrListA.Add(new ObjectAtribute("On action  ", trigA.OnAction, true));
                    triggerAtrListA.Add(new ObjectAtribute("Trigger name  ", trigA.Trigger_name, true));
                    triggerAtrListA.Add(new ObjectAtribute("Trigger owner  ", trigA.Trigger_owner, true));
                    compSQL = new ComparatorOfSQL(trigA.SqlText, null);
                    sqlTextListA = compSQL.TextA;
                    sqlTextListB = null;

                }
                else if (trigB != null)
                {
                    triggerName = trigB.Trigger_name;
                    triggerAtrListB.Add(new ObjectAtribute("Trigger name ", trigB.Trigger_name, true));
                    triggerAtrListB.Add(new ObjectAtribute("sql text  ", "Click button", true, true));
                    triggerAtrListB.Add(new ObjectAtribute("Disabled ", trigB.Disabled.ToString(), true));
                    triggerAtrListB.Add(new ObjectAtribute("Is after  ", trigB.IsAfter.ToString(), true));
                    triggerAtrListB.Add(new ObjectAtribute("Is instead  ", trigB.IsInsteadOf.ToString(), true));
                    triggerAtrListB.Add(new ObjectAtribute("On action  ", trigB.OnAction, true));
                    triggerAtrListB.Add(new ObjectAtribute("Trigger name  ", trigB.Trigger_name, true));
                    triggerAtrListB.Add(new ObjectAtribute("Trigger owner  ", trigB.Trigger_owner, true));
                    compSQL = new ComparatorOfSQL(null, trigB.SqlText);
                    sqlTextListA = null;
                    sqlTextListB = compSQL.TextB;
                }
                else triggerName = "UNDEFINED";
            }
            if (trigA != null && trigB != null)
            {
                compSQL = new ComparatorOfSQL(trigA.SqlText, trigB.SqlText);
                sqlTextListA = compSQL.TextA;
                sqlTextListB = compSQL.TextB;

                triggerName = trigA.Trigger_name;
                if (trigA.Disabled != trigB.Disabled) diffDisabled = true;
                if (trigA.IsAfter != trigB.IsAfter) diffIsAfter = true;
                if (trigA.IsInsteadOf != trigB.IsInsteadOf) diffIsInstead = true;
                if (trigA.OnAction != trigB.OnAction) diffOnAction = true;
                if (compSQL.IsDifferent) diffsqltext = true;
                if (trigA.Table_name != trigB.Table_name) diffTableName = true;
                if (trigA.Trigger_name != trigB.Trigger_name) diffTrigName = true;
                if (trigA.Trigger_owner != trigB.Trigger_owner) diffTRigOwner = true;
                if (diffDisabled || diffIsAfter || diffIsInstead || diffOnAction || diffsqltext || diffTableName || diffTrigName || diffTRigOwner) different = true;
                else different = false;

                ObjectAtribute oatriggerName = new ObjectAtribute("Trigger name ", this.triggerName, false);

                triggerAtrListA.Add(oatriggerName);
                triggerAtrListB.Add(oatriggerName);

                if (diffsqltext)
                {
                    ObjectAtribute tSqlTextA = new ObjectAtribute("sql text ", "Click button", true, true);
                    triggerAtrListA.Add(tSqlTextA);

                    ObjectAtribute tSqlTextB = new ObjectAtribute("sql text ", "Click button", true, true);
                    triggerAtrListB.Add(tSqlTextB);

                }
                else
                {
                    ObjectAtribute tSqlText = new ObjectAtribute("sql text ", "Click button", false, true);
                    triggerAtrListA.Add(tSqlText);
                    triggerAtrListB.Add(tSqlText);

                }

                if (diffDisabled)
                {
                    ObjectAtribute tDisabledA = new ObjectAtribute("Disabled ", trigA.Disabled.ToString(), true);
                    triggerAtrListA.Add(tDisabledA);
                    ObjectAtribute tDisabledB = new ObjectAtribute("Disabled ", trigB.Disabled.ToString(), true);
                    triggerAtrListB.Add(tDisabledB);
                }
                else
                {
                    ObjectAtribute tDisabled = new ObjectAtribute("Disabled ", trigB.Disabled.ToString(), false);
                    triggerAtrListA.Add(tDisabled);
                    triggerAtrListB.Add(tDisabled);
                }

                if (diffIsAfter)
                {
                    ObjectAtribute tIsAfterA = new ObjectAtribute("Is after ", trigA.IsAfter.ToString(), true);
                    triggerAtrListA.Add(tIsAfterA);
                    ObjectAtribute tIsAfterB = new ObjectAtribute("Is after ", trigB.IsAfter.ToString(), true);
                    triggerAtrListB.Add(tIsAfterB);
                }
                else
                {
                    ObjectAtribute tIsAfter = new ObjectAtribute("Is after ", trigB.IsAfter.ToString(), false);
                    triggerAtrListA.Add(tIsAfter);
                    triggerAtrListB.Add(tIsAfter);
                }

                if (diffIsInstead)
                {
                    ObjectAtribute tIsInsteadA = new ObjectAtribute("Is instead ", trigA.IsInsteadOf.ToString(), true);
                    triggerAtrListA.Add(tIsInsteadA);
                    ObjectAtribute tIsInsteadB = new ObjectAtribute("Is instead ", trigB.IsInsteadOf.ToString(), true);
                    triggerAtrListB.Add(tIsInsteadB);
                }
                else
                {
                    ObjectAtribute tIsInstead = new ObjectAtribute("Is instead ", trigB.IsInsteadOf.ToString(), false);
                    triggerAtrListA.Add(tIsInstead);
                    triggerAtrListB.Add(tIsInstead);
                }

                if (diffOnAction)
                {
                    ObjectAtribute tOnActionA = new ObjectAtribute("On action ", trigA.OnAction, true);
                    triggerAtrListA.Add(tOnActionA);
                    ObjectAtribute tOnActionB = new ObjectAtribute("On action ", trigB.OnAction, true);
                    triggerAtrListB.Add(tOnActionB);
                }
                else
                {
                    ObjectAtribute tIsInstead = new ObjectAtribute("On action ", trigB.OnAction, false);
                    triggerAtrListA.Add(tIsInstead);
                    triggerAtrListB.Add(tIsInstead);
                }

                if (diffTrigName)
                {
                    ObjectAtribute ttrigNameA = new ObjectAtribute("Trigger name ", trigA.Trigger_name, true);
                    triggerAtrListA.Add(ttrigNameA);
                    ObjectAtribute ttrigNameB = new ObjectAtribute("Trigger name ", trigB.Trigger_name, true);
                    triggerAtrListB.Add(ttrigNameB);
                }
                else
                {
                    ObjectAtribute ttrigName = new ObjectAtribute("Trigger name ", trigB.Trigger_name, false);
                    triggerAtrListA.Add(ttrigName);
                    triggerAtrListB.Add(ttrigName);
                }

                if (diffTRigOwner)
                {
                    ObjectAtribute ttrigOwnerA = new ObjectAtribute("Trigger owner ", trigA.Trigger_owner, true);
                    triggerAtrListA.Add(ttrigOwnerA);
                    ObjectAtribute ttrigOwnerB = new ObjectAtribute("Trigger owner ", trigB.Trigger_owner, true);
                    triggerAtrListB.Add(ttrigOwnerB);
                }
                else
                {
                    ObjectAtribute ttrigOwner = new ObjectAtribute("Trigger owner ", trigB.Trigger_owner, false);
                    triggerAtrListA.Add(ttrigOwner);
                    triggerAtrListB.Add(ttrigOwner);
                }

            }
            else different = true;
        }