Exemple #1
0
 public DbsyncTvFunctionType(SFunction sff)
 {
     this.sf         = sff;
     this.Text       = sf.NazovFunkcie;
     this.typeOfIcon = FunctionIcon;
     this.Name       = this.Text;
 }
Exemple #2
0
 //scripts to modify objects
 public abstract List <string> alterFunction(SFunction funkcIn);
Exemple #3
0
 public abstract List <string> removeFunction(SFunction funkcIn);
Exemple #4
0
 public abstract List <string> createFunction(SFunction funkcIn);
        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;
            }
        }
Exemple #6
0
 public override List <string> alterFunction(SFunction funkcIn)
 {
     throw new NotImplementedException();
 }