public DbsyncTvStoredProcType(SProcedure spp)
 {
     this.sp         = spp;
     this.Text       = spp.NazovProcedury;
     this.typeOfIcon = StoredProcedureIcon;
     this.Name       = this.Text;
 }
Exemple #2
0
 public abstract List <string> alterProcedure(SProcedure procIn);
Exemple #3
0
 //scripts to remove objects
 public abstract List <string> removeProcedure(SProcedure procIn);
Exemple #4
0
 //functions to generate scripts
 //scripts to create objects
 public abstract List <string> createProcedure(SProcedure procIn);
        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;
            }
        }
Exemple #6
0
 public override List <string> alterProcedure(SProcedure procIn)
 {
     throw new NotImplementedException();
 }