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; } }
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 DbSyncKeyDiff(Key keyAin, Key keyBin) { this.keyA = keyAin; this.keyB = keyBin; keyAtributesListA = new List<ObjectAtribute>(); keyAtributesListB = new List<ObjectAtribute>(); if (keyA != null && keyB != null) { if (!CompareColumns(keyA.NameOfColumns, keyB.NameOfColumns)) diffNameOfColumn = true; if (keyA.NameOfFcolumn != keyB.NameOfFcolumn) diffNameOfFkCol = true; if (keyA.NameofFTable != keyB.NameofFTable) diffNAmeOfFtable = true; if (keyA.PrimaryKey != keyB.PrimaryKey) diffPrimaryKey = true; if (diffNameOfColumn || diffNameOfFkCol || diffNAmeOfFtable || diffPrimaryKey) different = true; nameOfKey = keyA.NameOfKey; isPrimary = keyA.PrimaryKey; ObjectAtribute name = new ObjectAtribute("Name of key ",nameOfKey, false); keyAtributesListA.Add(name); keyAtributesListB.Add(name); keyAtributesListA.Add(new ObjectAtribute("Is primary key", keyA.PrimaryKey.ToString(), false)); keyAtributesListB.Add(new ObjectAtribute("Is primary key", keyB.PrimaryKey.ToString(), false)); if (diffNameOfColumn) { foreach (string nam in keyA.NameOfColumns) { keyAtributesListA.Add(new ObjectAtribute("Name of column", nam, true)); } foreach (string nam in keyB.NameOfColumns) { keyAtributesListB.Add(new ObjectAtribute("Name of column", nam, true)); } } else { foreach (string nam in keyA.NameOfColumns) { keyAtributesListA.Add(new ObjectAtribute("Name of column", nam, false)); keyAtributesListB.Add(new ObjectAtribute("Name of column", nam, false)); } } if (!isPrimary) { if (diffNAmeOfFtable) { keyAtributesListA.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, true)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein table", keyB.NameofFTable, true)); } else { keyAtributesListA.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, false)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, false)); } if (diffNameOfFkCol) { keyAtributesListA.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, true)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein column", keyB.NameOfFcolumn, true)); } else { keyAtributesListA.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, false)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, false)); } } } else { if (keyA != null) { different = true; nameOfKey = keyA.NameOfKey; isPrimary = keyA.PrimaryKey; ObjectAtribute name = new ObjectAtribute("Name of key ", nameOfKey, false); keyAtributesListA.Add(name); keyAtributesListA.Add(new ObjectAtribute("Is primary key", keyA.PrimaryKey.ToString(), true)); foreach (string nam in keyA.NameOfColumns) { keyAtributesListA.Add(new ObjectAtribute("Name of column", nam, true)); } if (!isPrimary) { keyAtributesListA.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, true)); keyAtributesListA.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, true)); } } if (keyB != null) { different = true; nameOfKey = keyB.NameOfKey; isPrimary = keyB.PrimaryKey; ObjectAtribute name = new ObjectAtribute("Name of key ", nameOfKey, false); keyAtributesListB.Add(name); keyAtributesListB.Add(new ObjectAtribute("Is primary key", keyB.PrimaryKey.ToString(), true)); foreach (string nam in keyB.NameOfColumns) { keyAtributesListB.Add(new ObjectAtribute("Name of column", nam, true)); } if (!isPrimary) { keyAtributesListB.Add(new ObjectAtribute("Name of Forein table", keyB.NameofFTable, true)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein column", keyB.NameOfFcolumn, true)); } } } }
public DbSyncColumnDiff(Columnn columnAin, Columnn columnBin) { ColumnA = columnAin; ColumnB = columnBin; columnAtributesListA = new List<ObjectAtribute>(); columnAtributesListB = new List<ObjectAtribute>(); if (ColumnA == null || ColumnB == null) { if (ColumnA != null) { this.columnName = ColumnA.COULUMN_NAME1; columnAtributesListA.Add(new ObjectAtribute("Name of column", ColumnA.COULUMN_NAME1, true)); columnAtributesListA.Add(new ObjectAtribute("Coulumn default", ColumnA.COULUMN_DEFAULT1, true)); columnAtributesListA.Add(new ObjectAtribute("Datatype", ColumnA.DATA_TYPE1, true)); columnAtributesListA.Add(new ObjectAtribute("Date Time Precision", ColumnA.DATETIME_PRECISION1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set catalog", ColumnA.CHARACTER_SET_CATALOG1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set name", ColumnA.CHARACTER_SET_NAME1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set schema", ColumnA.CHARACTER_SET_SCHEMA1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character max length", ColumnA.CHARACTER_MAXIMUM_LENGTH1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character octet length", ColumnA.CHARACTER_OCTET_LENGTH1, true)); columnAtributesListA.Add(new ObjectAtribute("Is nullable", ColumnA.IS_NULLABLE1, true)); columnAtributesListA.Add(new ObjectAtribute("Numeric precision", ColumnA.NUMERIC_PRECISION1, true)); columnAtributesListA.Add(new ObjectAtribute("Numeric scale", ColumnA.NUMERIC_SCALE1, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of fk Column", ColumnA.FK_NameOFPKCol, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of fk Tab", ColumnA.FK_nameOFPKTab, true)); //columnAtributesListA.Add(new ObjectAtribute("Is forein Key", ColumnA.Is_foreinKey().ToString(), true)); //columnAtributesListA.Add(new ObjectAtribute("Is primary Key", ColumnA.Is_primaryKey().ToString(), true)); //columnAtributesListA.Add(new ObjectAtribute("Name of Fk", ColumnA.Name_of_FK, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of pk", ColumnA.Name_of_PK, true)); } else if (ColumnB != null) { this.columnName = ColumnB.COULUMN_NAME1; columnAtributesListB.Add(new ObjectAtribute("Name of column", ColumnB.COULUMN_NAME1, true)); columnAtributesListB.Add(new ObjectAtribute("Coulumn default", ColumnB.COULUMN_DEFAULT1, true)); columnAtributesListB.Add(new ObjectAtribute("Datatype", ColumnB.DATA_TYPE1, true)); columnAtributesListB.Add(new ObjectAtribute("Date Time Precision", ColumnB.DATETIME_PRECISION1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set catalog", ColumnB.CHARACTER_SET_CATALOG1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set name", ColumnB.CHARACTER_SET_NAME1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set schema", ColumnB.CHARACTER_SET_SCHEMA1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character max length", ColumnB.CHARACTER_MAXIMUM_LENGTH1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character octet length", ColumnB.CHARACTER_OCTET_LENGTH1, true)); columnAtributesListB.Add(new ObjectAtribute("Is nullable", ColumnB.IS_NULLABLE1, true)); columnAtributesListB.Add(new ObjectAtribute("Numeric precision", ColumnB.NUMERIC_PRECISION1, true)); columnAtributesListB.Add(new ObjectAtribute("Numeric scale", ColumnB.NUMERIC_SCALE1, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of fk Column", ColumnB.FK_NameOFPKCol, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of fk Tab", ColumnB.FK_nameOFPKTab, true)); //columnAtributesListB.Add(new ObjectAtribute("Is forein Key", ColumnB.Is_foreinKey().ToString(), true)); //columnAtributesListB.Add(new ObjectAtribute("Is primary Key", ColumnB.Is_primaryKey().ToString(), true)); //columnAtributesListB.Add(new ObjectAtribute("Name of Fk", ColumnB.Name_of_FK, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of pk", ColumnB.Name_of_PK, true)); } else this.columnName = "UNDEFINED"; } if (ColumnA != null && ColumnB != null) { this.columnName = ColumnA.COULUMN_NAME1; if (ColumnA.COULUMN_DEFAULT1 != ColumnB.COULUMN_DEFAULT1) diffColumnDefault = true; if (ColumnA.COULUMN_NAME1 != ColumnB.COULUMN_NAME1) diffColumnName = true; if (ColumnA.DATA_TYPE1 != ColumnB.DATA_TYPE1) diffDatatype = true; if (ColumnA.DATETIME_PRECISION1 != ColumnB.DATETIME_PRECISION1) diffDatetimePrecision = true; //if (ColumnA.FK_NameOFPKCol != ColumnB.FK_NameOFPKCol) diffFkNameOfPkCol = true; //if (ColumnA.FK_nameOFPKTab != ColumnB.FK_nameOFPKTab) diffFkNameOfPKTab = true; if (ColumnA.CHARACTER_MAXIMUM_LENGTH1 != ColumnB.CHARACTER_MAXIMUM_LENGTH1) diffCharMaxLength = true; //if (ColumnA.CHARACTER_OCTET_LENGTH1 != ColumnB.CHARACTER_OCTET_LENGTH1) diffCharOctetLength = true; //if (ColumnA.CHARACTER_SET_CATALOG1 != ColumnB.CHARACTER_SET_CATALOG1) diffCharacterSetCatalog = true; //if (ColumnA.CHARACTER_SET_NAME1 != ColumnB.CHARACTER_SET_NAME1) diffCharacterSetName = true; //if (ColumnA.CHARACTER_SET_SCHEMA1 != ColumnB.CHARACTER_SET_SCHEMA1) diffCharacterSetSchema = true; if (ColumnA.IS_NULLABLE1 != ColumnB.IS_NULLABLE1) diffIsNullable = true; //if (ColumnA.Name_of_FK != ColumnB.Name_of_FK) diffNameOfFK = true; //if (ColumnA.Name_of_PK != ColumnB.Name_of_PK) diffNameOfPk = true; //if (ColumnA.NazovStlpca != ColumnB.NazovStlpca) diffNameOfColumn = true; //if (ColumnA.NUMERIC_PRECISION_RADIX1 != ColumnB.NUMERIC_PRECISION_RADIX1) diffNumericPRecisionRadix = true; if (ColumnA.NUMERIC_PRECISION1 != ColumnB.NUMERIC_PRECISION1) diffNumericPrecision = true; if (ColumnA.NUMERIC_SCALE1 != ColumnB.NUMERIC_SCALE1) diffNumericScale = true; // if (ColumnA.ORDINAL_POSITION1 != ColumnB.ORDINAL_POSITION1) diffOrdinalPosition = true; //if (ColumnA.TABLE_NAME1 != ColumnB.TABLE_NAME1) diffTableName = true; //if (ColumnA.Is_foreinKey() != ColumnB.Is_foreinKey()) diffIsForeinKey = true; //if (ColumnA.Is_primaryKey() != ColumnB.Is_primaryKey()) diffIsPrimarykey = true; if (diffColumnDefault || diffColumnName || diffDatatype || diffDatetimePrecision || diffFkNameOfPkCol || diffFkNameOfPKTab || diffCharacterSetCatalog || diffCharacterSetName || diffCharacterSetSchema || diffCharMaxLength || diffCharOctetLength || diffIsForeinKey || diffIsNullable || diffIsPrimarykey || diffNameOfColumn || diffNameOfFK || diffNameOfPk || diffNumericPrecision || diffNumericScale ) different = true; else different = false; //naplnenie zoznamu atributov pre potreby zobrazovania ObjectAtribute columnNameOA = new ObjectAtribute("Name of column", columnName, false); columnAtributesListA.Add(columnNameOA); columnAtributesListB.Add(columnNameOA); if (diffColumnDefault) { ObjectAtribute cDefaultA = new ObjectAtribute("Coulumn default ", ColumnA.COULUMN_DEFAULT1, true); columnAtributesListA.Add(cDefaultA); ObjectAtribute cDefaultB = new ObjectAtribute("Coulumn default ", ColumnB.COULUMN_DEFAULT1, true); columnAtributesListB.Add(cDefaultB); } else { ObjectAtribute cDefault = new ObjectAtribute("Coulumn default ", ColumnA.COULUMN_DEFAULT1, false); columnAtributesListA.Add(cDefault); columnAtributesListB.Add(cDefault); } if (diffDatatype) { ObjectAtribute cDatatypeA = new ObjectAtribute("Datatype ", ColumnA.DATA_TYPE1, true); columnAtributesListA.Add(cDatatypeA); ObjectAtribute cDatatypeB = new ObjectAtribute("Datatype ", ColumnB.DATA_TYPE1, true); columnAtributesListB.Add(cDatatypeB); } else { ObjectAtribute cDatatype = new ObjectAtribute("Datatype ", ColumnA.DATA_TYPE1, false); columnAtributesListA.Add(cDatatype); columnAtributesListB.Add(cDatatype); } if (diffDatetimePrecision) { ObjectAtribute cDateTimePrecisionA = new ObjectAtribute("Date Time Precision ", ColumnA.DATETIME_PRECISION1, true); columnAtributesListA.Add(cDateTimePrecisionA); ObjectAtribute cDateTimePrecisionB = new ObjectAtribute("Date Time Precision ", ColumnB.DATETIME_PRECISION1, true); columnAtributesListB.Add(cDateTimePrecisionB); } else { ObjectAtribute cDateTimePrecision = new ObjectAtribute("Date Time Precision ", ColumnA.DATETIME_PRECISION1, false); columnAtributesListA.Add(cDateTimePrecision); columnAtributesListB.Add(cDateTimePrecision); } //if (diffCharacterSetCatalog) //{ // ObjectAtribute cCheracterSetCatA = new ObjectAtribute("Character set catalog ", ColumnA.CHARACTER_SET_CATALOG1, true); // columnAtributesListA.Add(cCheracterSetCatA); // ObjectAtribute cCheracterSetCatB = new ObjectAtribute("Character set catalog ", ColumnB.CHARACTER_SET_CATALOG1, true); // columnAtributesListB.Add(cCheracterSetCatB); //} //else //{ // ObjectAtribute cCheracterSetCat = new ObjectAtribute("Character set catalog ", ColumnA.CHARACTER_SET_CATALOG1, false); // columnAtributesListA.Add(cCheracterSetCat); // columnAtributesListB.Add(cCheracterSetCat); //} //if (diffCharacterSetName) //{ // ObjectAtribute cCharacterSetNameA = new ObjectAtribute("Character set name ", ColumnA.CHARACTER_SET_NAME1, true); // columnAtributesListA.Add(cCharacterSetNameA); // ObjectAtribute cCharacterSetNameB = new ObjectAtribute("Character set name", ColumnB.CHARACTER_SET_NAME1, true); // columnAtributesListB.Add(cCharacterSetNameB); //} //else //{ // ObjectAtribute cCheracterSetCat = new ObjectAtribute("Character set name ", ColumnA.CHARACTER_SET_NAME1, false); // columnAtributesListA.Add(cCheracterSetCat); // columnAtributesListB.Add(cCheracterSetCat); //} //if (diffCharacterSetSchema) //{ // ObjectAtribute cCharacterSetSchemaA = new ObjectAtribute("Character set schema ", ColumnA.CHARACTER_SET_SCHEMA1, true); // columnAtributesListA.Add(cCharacterSetSchemaA); // ObjectAtribute cCharacterSetSchemaB = new ObjectAtribute("Character set schema", ColumnB.CHARACTER_SET_SCHEMA1, true); // columnAtributesListB.Add(cCharacterSetSchemaB); //} //else //{ // ObjectAtribute cCharacterSetSchema = new ObjectAtribute("Character set schema", ColumnA.CHARACTER_SET_SCHEMA1, false); // columnAtributesListA.Add(cCharacterSetSchema); // columnAtributesListB.Add(cCharacterSetSchema); //} if (diffCharMaxLength) { ObjectAtribute cCharacterMaxLEngthA = new ObjectAtribute("Character max length ", ColumnA.CHARACTER_MAXIMUM_LENGTH1, true); columnAtributesListA.Add(cCharacterMaxLEngthA); ObjectAtribute cCharacterMaxLEngthB = new ObjectAtribute("Character max length ", ColumnB.CHARACTER_MAXIMUM_LENGTH1, true); columnAtributesListB.Add(cCharacterMaxLEngthB); } else { ObjectAtribute cCharacterMaxLEngth = new ObjectAtribute("Character max length ", ColumnA.CHARACTER_MAXIMUM_LENGTH1, false); columnAtributesListA.Add(cCharacterMaxLEngth); columnAtributesListB.Add(cCharacterMaxLEngth); } // if (diffCharOctetLength) //{ // ObjectAtribute cCharacterOctetLEngthA = new ObjectAtribute("Character octet length ", ColumnA.CHARACTER_OCTET_LENGTH1, true); // columnAtributesListA.Add(cCharacterOctetLEngthA); // ObjectAtribute cCharacterOctetLEngthB = new ObjectAtribute("Character octet length ", ColumnB.CHARACTER_OCTET_LENGTH1, true); // columnAtributesListB.Add(cCharacterOctetLEngthB); //} //else //{ // ObjectAtribute cCharacterOctetLEngth = new ObjectAtribute("Character octet length ", ColumnA.CHARACTER_OCTET_LENGTH1, false); // columnAtributesListA.Add(cCharacterOctetLEngth); // columnAtributesListB.Add(cCharacterOctetLEngth); //} if (diffIsNullable) { ObjectAtribute cIsNullableA = new ObjectAtribute("Is nullable ", ColumnA.IS_NULLABLE1, true); columnAtributesListA.Add(cIsNullableA); ObjectAtribute cIsNullableB = new ObjectAtribute("Is nullable ", ColumnB.IS_NULLABLE1, true); columnAtributesListB.Add(cIsNullableB); } else { ObjectAtribute cIsNullable = new ObjectAtribute("Is nullable", ColumnA.IS_NULLABLE1, false); columnAtributesListA.Add(cIsNullable); columnAtributesListB.Add(cIsNullable); } if (diffNumericPrecision) { ObjectAtribute cNumericPrecisionA = new ObjectAtribute("Numeric precision ", ColumnA.NUMERIC_PRECISION1, true); columnAtributesListA.Add(cNumericPrecisionA); ObjectAtribute cNumericPrecisionB = new ObjectAtribute("Numeric precision ", ColumnB.NUMERIC_PRECISION1, true); columnAtributesListB.Add(cNumericPrecisionB); } else { ObjectAtribute cNumericPrecision = new ObjectAtribute("Numeric precision ", ColumnA.NUMERIC_PRECISION1, false); columnAtributesListA.Add(cNumericPrecision); columnAtributesListB.Add(cNumericPrecision); } if (diffNumericScale) { ObjectAtribute cNumericScaleA = new ObjectAtribute("Numeric scale ", ColumnA.NUMERIC_SCALE1, true); columnAtributesListA.Add(cNumericScaleA); ObjectAtribute cNumericScaleB = new ObjectAtribute("Numeric scale", ColumnB.NUMERIC_SCALE1, true); columnAtributesListB.Add(cNumericScaleB); } else { ObjectAtribute cNumericScale = new ObjectAtribute("Numeric scale", ColumnA.NUMERIC_SCALE1, false); columnAtributesListA.Add(cNumericScale); columnAtributesListB.Add(cNumericScale); } //if (diffFkNameOfPkCol) //{ // ObjectAtribute cNameOfPkColA = new ObjectAtribute("Name of fk Column ", ColumnA.FK_NameOFPKCol, true); // columnAtributesListA.Add(cNameOfPkColA); // ObjectAtribute cNameOfPkColB = new ObjectAtribute("Name of fk Column ", ColumnB.FK_NameOFPKCol, true); // columnAtributesListB.Add(cNameOfPkColB); //} //else //{ // ObjectAtribute cNameOfPkCol = new ObjectAtribute("Name of fk Column ", ColumnA.FK_NameOFPKCol, false); // columnAtributesListA.Add(cNameOfPkCol); // columnAtributesListB.Add(cNameOfPkCol); //} //if (diffFkNameOfPKTab) //{ // ObjectAtribute cNameOfPkTabA = new ObjectAtribute("Name of fk Tab ", ColumnA.FK_nameOFPKTab, true); // columnAtributesListA.Add(cNameOfPkTabA); // ObjectAtribute cNameOfPkTabB = new ObjectAtribute("Name of fk Tab ", ColumnB.FK_nameOFPKTab, true); // columnAtributesListB.Add(cNameOfPkTabB); //} //else //{ // ObjectAtribute cNameOfPkTab = new ObjectAtribute("Name of fk Tab ", ColumnA.FK_nameOFPKTab, false); // columnAtributesListA.Add(cNameOfPkTab); // columnAtributesListB.Add(cNameOfPkTab); //} //if (diffIsForeinKey) //{ // ObjectAtribute cIsForeinKeyA = new ObjectAtribute("Is forein Key ", ColumnA.Is_foreinKey().ToString(), true); // columnAtributesListA.Add(cIsForeinKeyA); // ObjectAtribute cIsForeinKeyB = new ObjectAtribute("Is forein Key ", ColumnB.Is_foreinKey().ToString(), true); // columnAtributesListB.Add(cIsForeinKeyB); //} //else //{ // ObjectAtribute cIsForeinKey = new ObjectAtribute("Is forein Key ", ColumnA.Is_foreinKey().ToString(), false); // columnAtributesListA.Add(cIsForeinKey); // columnAtributesListB.Add(cIsForeinKey); //} //if (diffIsPrimarykey) //{ // ObjectAtribute cIsPrimaryKeyA = new ObjectAtribute("Is primary Key ", ColumnA.Is_primaryKey().ToString(), true); // columnAtributesListA.Add(cIsPrimaryKeyA); // ObjectAtribute cIsPrimaryKeyB = new ObjectAtribute("Is primary Key ", ColumnB.Is_primaryKey().ToString(), true); // columnAtributesListB.Add(cIsPrimaryKeyB); //} //else //{ // ObjectAtribute cIsPrimaryKey = new ObjectAtribute("Is primary Key ", ColumnA.Is_primaryKey().ToString(), false); // columnAtributesListA.Add(cIsPrimaryKey); // columnAtributesListB.Add(cIsPrimaryKey); //} //if (diffNameOfFK) //{ // ObjectAtribute cNameOfFkA = new ObjectAtribute("Name of Fk ", ColumnA.Name_of_FK, true); // columnAtributesListA.Add(cNameOfFkA); // ObjectAtribute cNameOfFkB = new ObjectAtribute("Name of Fk ", ColumnB.Name_of_FK, true); // columnAtributesListB.Add(cNameOfFkB); //} //else //{ // ObjectAtribute cNameOfFk = new ObjectAtribute("Name of Fk ", ColumnA.Name_of_FK, false); // columnAtributesListA.Add(cNameOfFk); // columnAtributesListB.Add(cNameOfFk); //} //if (diffNameOfPk) //{ // ObjectAtribute cNameOfPkA = new ObjectAtribute("Name of pk ", ColumnA.Name_of_PK, true); // columnAtributesListA.Add(cNameOfPkA); // ObjectAtribute cNameOfPkB = new ObjectAtribute("Name of pk ", ColumnB.Name_of_PK, true); // columnAtributesListB.Add(cNameOfPkB); //} //else //{ // ObjectAtribute cNameOfPk = new ObjectAtribute("Name of pk ", ColumnA.Name_of_PK, false); // columnAtributesListA.Add(cNameOfPk); // columnAtributesListB.Add(cNameOfPk); //} } 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; }
public DbSyncUserDiff(User userAin, User userBin) { this.userA = userAin; this.userB = userBin; userAtributesA = new List<ObjectAtribute>(); userAtributesB = new List<ObjectAtribute>(); if (userA == null || userB == null) { if (this.userA != null) { userName = userA.UserName; userAtributesA.Add(new ObjectAtribute("User name ", userA.UserName, true)); userAtributesA.Add(new ObjectAtribute("User login ", userA.UserName, true)); foreach (string s in userA.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, true); userAtributesA.Add(rolaA); } } else if (this.userB != null) { userName = userB.UserName; userAtributesB.Add(new ObjectAtribute("User name ", userB.UserName, true)); userAtributesB.Add(new ObjectAtribute("User login ", userB.UserName, true)); foreach (string s in userB.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, true); userAtributesB.Add(rolaA); } } else userName = "******"; } if (userA != null && userB != null) { userName = userA.UserName; if (userA.Login != userB.Login) diffLogin = true; //if (userA.User_id != userB.User_id) diffUserId = true; //asi to netreba if (userA.UserName != userB.UserName) diffUserName = true; if (!CompareRoles(userA.Roly, userB.Roly)) diffRoles = true; if (diffLogin || diffRoles || diffUserName) different = true; else different = false; userAtributesA.Add(new ObjectAtribute("User name ", userName, false)); userAtributesB.Add(new ObjectAtribute("User name ", userName, false)); if (diffLogin) { ObjectAtribute loginA = new ObjectAtribute("User login", userA.Login, true); userAtributesA.Add(loginA); ObjectAtribute loginB = new ObjectAtribute("User login", userB.Login, true); userAtributesB.Add(loginB); } else { ObjectAtribute loginA = new ObjectAtribute("User login", userA.Login, false); userAtributesA.Add(loginA); userAtributesB.Add(loginA); } if (diffRoles) { foreach (string s in userA.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, true); userAtributesA.Add(rolaA); } foreach (string s in userB.Roly) { ObjectAtribute rolaB = new ObjectAtribute("Role", s, true); userAtributesB.Add(rolaB); } } else { foreach (string s in userA.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, false); userAtributesA.Add(rolaA); userAtributesB.Add(rolaA); } } } else different = true; }
public DbSyncUserDiff(User userAin, User userBin) { this.userA = userAin; this.userB = userBin; userAtributesA = new List <ObjectAtribute>(); userAtributesB = new List <ObjectAtribute>(); if (userA == null || userB == null) { if (this.userA != null) { userName = userA.UserName; userAtributesA.Add(new ObjectAtribute("User name ", userA.UserName, true)); userAtributesA.Add(new ObjectAtribute("User login ", userA.UserName, true)); foreach (string s in userA.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, true); userAtributesA.Add(rolaA); } } else if (this.userB != null) { userName = userB.UserName; userAtributesB.Add(new ObjectAtribute("User name ", userB.UserName, true)); userAtributesB.Add(new ObjectAtribute("User login ", userB.UserName, true)); foreach (string s in userB.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, true); userAtributesB.Add(rolaA); } } else { userName = "******"; } } if (userA != null && userB != null) { userName = userA.UserName; if (userA.Login != userB.Login) { diffLogin = true; } //if (userA.User_id != userB.User_id) diffUserId = true; //asi to netreba if (userA.UserName != userB.UserName) { diffUserName = true; } if (!CompareRoles(userA.Roly, userB.Roly)) { diffRoles = true; } if (diffLogin || diffRoles || diffUserName) { different = true; } else { different = false; } userAtributesA.Add(new ObjectAtribute("User name ", userName, false)); userAtributesB.Add(new ObjectAtribute("User name ", userName, false)); if (diffLogin) { ObjectAtribute loginA = new ObjectAtribute("User login", userA.Login, true); userAtributesA.Add(loginA); ObjectAtribute loginB = new ObjectAtribute("User login", userB.Login, true); userAtributesB.Add(loginB); } else { ObjectAtribute loginA = new ObjectAtribute("User login", userA.Login, false); userAtributesA.Add(loginA); userAtributesB.Add(loginA); } if (diffRoles) { foreach (string s in userA.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, true); userAtributesA.Add(rolaA); } foreach (string s in userB.Roly) { ObjectAtribute rolaB = new ObjectAtribute("Role", s, true); userAtributesB.Add(rolaB); } } else { foreach (string s in userA.Roly) { ObjectAtribute rolaA = new ObjectAtribute("Role", s, false); userAtributesA.Add(rolaA); userAtributesB.Add(rolaA); } } } else { different = true; } }
public DbSyncIndexDiff(Index indexAin, Index indexBin) { this.indexA = indexAin; this.indexB = indexBin; indexAtributesListA = new List<ObjectAtribute>(); indexAtributesListB = new List<ObjectAtribute>(); if (indexA == null || indexB == null) { if (indexA != null) { nameOfIndex = indexA.Name; indexAtributesListA.Add(new ObjectAtribute("Index name", indexA.Name, true)); indexAtributesListA.Add(new ObjectAtribute("Index type", indexA.Type, true)); indexAtributesListA.Add(new ObjectAtribute("Is unique", indexA.Unique.ToString(), true)); foreach (string s in indexA.Columns) { indexAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } } else if (indexB != null) { nameOfIndex = indexB.Name; indexAtributesListB.Add(new ObjectAtribute("Index name", indexB.Name, true)); indexAtributesListB.Add(new ObjectAtribute("Index type", indexB.Type, true)); indexAtributesListB.Add(new ObjectAtribute("Is unique", indexB.Unique.ToString(), true)); foreach (string s in indexB.Columns) { indexAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else nameOfIndex = "UNDEFINED"; } if (indexA != null && indexB != null) { nameOfIndex = indexA.Name; if (indexA.Name != indexB.Name) diffindexName = true; if (indexA.Type != indexB.Type) diffindexType = true; if (indexA.Unique != indexB.Unique) diffIndexUnique = true; if (!CompareColumns(indexA.Columns, indexB.Columns)) diffColumns = true; if (diffindexName || diffindexType || diffIndexUnique) different = true; else different = false; ObjectAtribute Iname = new ObjectAtribute("Index name", indexA.Name, false); indexAtributesListA.Add(Iname); indexAtributesListB.Add(Iname); if (diffindexType) { ObjectAtribute ItypeA = new ObjectAtribute("Index type ", indexA.Type, true); indexAtributesListA.Add(ItypeA); ObjectAtribute ItypeB = new ObjectAtribute("Index type ", indexB.Type, true); indexAtributesListB.Add(ItypeB); } else { ObjectAtribute Itype = new ObjectAtribute("Index type ", indexA.Type, false); indexAtributesListA.Add(Itype); indexAtributesListB.Add(Itype); } if (diffIndexUnique) { ObjectAtribute IuniqueA = new ObjectAtribute("Is unique ", indexA.Unique.ToString(), true); indexAtributesListA.Add(IuniqueA); ObjectAtribute IuniqueB = new ObjectAtribute("Is unique ", indexB.Unique.ToString(), true); indexAtributesListB.Add(IuniqueB); } else { ObjectAtribute Iunique = new ObjectAtribute("Is unique ", indexA.Unique.ToString(), false); indexAtributesListA.Add(Iunique); indexAtributesListB.Add(Iunique); } if (diffColumns) { foreach (string s in indexA.Columns) { indexAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } foreach (string s in indexB.Columns) { indexAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else { foreach (string s in indexA.Columns) { indexAtributesListB.Add(new ObjectAtribute("Column ", s, false)); indexAtributesListA.Add(new ObjectAtribute("Column ", s, false)); } } } else different = true; }
public DbSyncTypeDiff(Typ typeAin, Typ typeBin) { this.typeA = typeAin; this.typeB = typeBin; typeAtributesA = new List <ObjectAtribute>(); typeAtributesB = new List <ObjectAtribute>(); if (typeA == null || typeB == null) { if (typeA != null) { typeName = typeA.Nazov; typeAtributesA.Add(new ObjectAtribute("Name of type", typeName, true)); typeAtributesA.Add(new ObjectAtribute("Type datatype ", typeA.Datatyp, true)); typeAtributesA.Add(new ObjectAtribute("Type precision ", typeA.Precision, true)); typeAtributesA.Add(new ObjectAtribute("Type scale ", typeA.Scale, true)); typeAtributesA.Add(new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), true)); } else if (typeB != null) { typeName = typeB.Nazov; typeAtributesB.Add(new ObjectAtribute("Name of type", typeName, true)); typeAtributesA.Add(new ObjectAtribute("Type datatype ", typeB.Datatyp, true)); typeAtributesA.Add(new ObjectAtribute("Type precision ", typeB.Precision, true)); typeAtributesA.Add(new ObjectAtribute("Type scale ", typeB.Scale, true)); typeAtributesA.Add(new ObjectAtribute("Type Is Nullable ", typeB.CanBeNull.ToString(), true)); } else { typeName = "UNDEFINED"; } } if (typeA != null && typeB != null) { if (typeA.Datatyp != typeB.Datatyp) { diffTypeDatatype = true; } if (typeA.Precision != typeB.Precision) { diffPrecision = true; } if (typeA.Scale != typeB.Scale) { diffScale = true; } if (typeA.CanBeNull != typeB.CanBeNull) { diffCanBeNull = true; } if (typeA.Nazov != typeB.Nazov) { diffTypeNAme = true; } if (diffPrecision || diffScale || diffTypeDatatype || diffTypeNAme || diffCanBeNull) { different = true; } else { different = false; } typeName = typeA.Nazov; typeAtributesA.Add(new ObjectAtribute("Name of type", typeName, false)); typeAtributesB.Add(new ObjectAtribute("Name of type", typeName, false)); if (diffPrecision) { ObjectAtribute tcharA = new ObjectAtribute("Type precision ", typeA.Precision, true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Type precision ", typeB.Precision, true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Type precision ", typeA.Precision, false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } if (diffScale) { ObjectAtribute tcharA = new ObjectAtribute("Type scale ", typeA.Scale, true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Type scale ", typeB.Scale, true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Type scale ", typeA.Scale, false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } if (diffTypeDatatype) { ObjectAtribute tcharA = new ObjectAtribute("Datatype ", typeA.Datatyp, true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Datatype ", typeB.Datatyp, true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Datatype ", typeA.Datatyp, false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } if (diffCanBeNull) { ObjectAtribute tcharA = new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Type Is Nullable ", typeB.CanBeNull.ToString(), true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } } else { different = true; } }
public DbSyncKeyDiff(Key keyAin, Key keyBin) { this.keyA = keyAin; this.keyB = keyBin; keyAtributesListA = new List <ObjectAtribute>(); keyAtributesListB = new List <ObjectAtribute>(); if (keyA != null && keyB != null) { if (!CompareColumns(keyA.NameOfColumns, keyB.NameOfColumns)) { diffNameOfColumn = true; } if (keyA.NameOfFcolumn != keyB.NameOfFcolumn) { diffNameOfFkCol = true; } if (keyA.NameofFTable != keyB.NameofFTable) { diffNAmeOfFtable = true; } if (keyA.PrimaryKey != keyB.PrimaryKey) { diffPrimaryKey = true; } if (diffNameOfColumn || diffNameOfFkCol || diffNAmeOfFtable || diffPrimaryKey) { different = true; } nameOfKey = keyA.NameOfKey; isPrimary = keyA.PrimaryKey; ObjectAtribute name = new ObjectAtribute("Name of key ", nameOfKey, false); keyAtributesListA.Add(name); keyAtributesListB.Add(name); keyAtributesListA.Add(new ObjectAtribute("Is primary key", keyA.PrimaryKey.ToString(), false)); keyAtributesListB.Add(new ObjectAtribute("Is primary key", keyB.PrimaryKey.ToString(), false)); if (diffNameOfColumn) { foreach (string nam in keyA.NameOfColumns) { keyAtributesListA.Add(new ObjectAtribute("Name of column", nam, true)); } foreach (string nam in keyB.NameOfColumns) { keyAtributesListB.Add(new ObjectAtribute("Name of column", nam, true)); } } else { foreach (string nam in keyA.NameOfColumns) { keyAtributesListA.Add(new ObjectAtribute("Name of column", nam, false)); keyAtributesListB.Add(new ObjectAtribute("Name of column", nam, false)); } } if (!isPrimary) { if (diffNAmeOfFtable) { keyAtributesListA.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, true)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein table", keyB.NameofFTable, true)); } else { keyAtributesListA.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, false)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, false)); } if (diffNameOfFkCol) { keyAtributesListA.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, true)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein column", keyB.NameOfFcolumn, true)); } else { keyAtributesListA.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, false)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, false)); } } } else { if (keyA != null) { different = true; nameOfKey = keyA.NameOfKey; isPrimary = keyA.PrimaryKey; ObjectAtribute name = new ObjectAtribute("Name of key ", nameOfKey, false); keyAtributesListA.Add(name); keyAtributesListA.Add(new ObjectAtribute("Is primary key", keyA.PrimaryKey.ToString(), true)); foreach (string nam in keyA.NameOfColumns) { keyAtributesListA.Add(new ObjectAtribute("Name of column", nam, true)); } if (!isPrimary) { keyAtributesListA.Add(new ObjectAtribute("Name of Forein table", keyA.NameofFTable, true)); keyAtributesListA.Add(new ObjectAtribute("Name of Forein column", keyA.NameOfFcolumn, true)); } } if (keyB != null) { different = true; nameOfKey = keyB.NameOfKey; isPrimary = keyB.PrimaryKey; ObjectAtribute name = new ObjectAtribute("Name of key ", nameOfKey, false); keyAtributesListB.Add(name); keyAtributesListB.Add(new ObjectAtribute("Is primary key", keyB.PrimaryKey.ToString(), true)); foreach (string nam in keyB.NameOfColumns) { keyAtributesListB.Add(new ObjectAtribute("Name of column", nam, true)); } if (!isPrimary) { keyAtributesListB.Add(new ObjectAtribute("Name of Forein table", keyB.NameofFTable, true)); keyAtributesListB.Add(new ObjectAtribute("Name of Forein column", keyB.NameOfFcolumn, true)); } } } }
public DbSyncPrivilegeDiff(Privilege privAin, Privilege privBin) { this.privA = privAin; this.privB = privBin; privAtrListA = new List <ObjectAtribute>(); privAtrListB = new List <ObjectAtribute>(); if (privA == null || privB == null) { if (privA != null) { this.privilegeName = privA.Grantee + " " + privA.Privilege_type; privAtrListA.Add(new ObjectAtribute("Object name", privA.Table_name, true)); privAtrListA.Add(new ObjectAtribute("Grantee", privA.Grantee, true)); //privAtrListA.Add(new ObjectAtribute("Is Grantable", privA.Is_grantable.ToString(), true)); privAtrListA.Add(new ObjectAtribute("Privilege type", privA.Privilege_type, true)); } else if (privB != null) { this.privilegeName = privB.Grantee + " " + privB.Privilege_type; privAtrListB.Add(new ObjectAtribute("Object name", privB.Table_name, true)); privAtrListB.Add(new ObjectAtribute("Grantee", privB.Grantee, true)); //privAtrListB.Add(new ObjectAtribute("Is Grantable", privB.Is_grantable.ToString(), true)); privAtrListB.Add(new ObjectAtribute("Privilege type", privB.Privilege_type, true)); } else { this.privilegeName = "UNDEFINED"; } } if (privA != null && privB != null) { this.privilegeName = privA.Grantee + " " + privA.Privilege_type; if (privA.Grantee != privB.Grantee) { diffGrantee = true; } //if (privA.Is_grantable != privB.Is_grantable) diffISGrantable = true; if (privA.Table_name != privB.Table_name) { diffTableNAme = true; } if (privA.Privilege_type != privB.Privilege_type) { diffprivilegeType = true; } if (diffGrantee || diffISGrantable || diffprivilegeType || diffTableNAme) { different = true; } else { different = false; } ObjectAtribute cObjectname = new ObjectAtribute("Object name ", privA.Table_name, false); privAtrListA.Add(cObjectname); privAtrListB.Add(cObjectname); if (diffGrantee) { ObjectAtribute cGranteA = new ObjectAtribute("Grantee ", privA.Grantee, true); privAtrListA.Add(cGranteA); ObjectAtribute cGranteB = new ObjectAtribute("Grantee ", privB.Grantee, true); privAtrListB.Add(cGranteB); } else { ObjectAtribute cGrantee = new ObjectAtribute("Grantee ", privB.Grantee, false); privAtrListA.Add(cGrantee); privAtrListB.Add(cGrantee); } /*if (diffISGrantable) * { * ObjectAtribute cIsGrantableA = new ObjectAtribute("Is Grantable ", privA.Is_grantable.ToString(), true); * privAtrListA.Add(cIsGrantableA); * ObjectAtribute cIsGrantableB = new ObjectAtribute("Is Grantable ", privB.Is_grantable.ToString(), true); * privAtrListB.Add(cIsGrantableB); * } * else * { * ObjectAtribute cIsGrantable = new ObjectAtribute("Is Grantable ", privB.Is_grantable.ToString(), false); * privAtrListA.Add(cIsGrantable); * privAtrListB.Add(cIsGrantable); * } */ if (diffprivilegeType) { ObjectAtribute cPrivilegeTypeA = new ObjectAtribute("Privilege type ", privA.Privilege_type, true); privAtrListA.Add(cPrivilegeTypeA); ObjectAtribute cPrivilegeTypeB = new ObjectAtribute("Privilege type ", privB.Privilege_type, true); privAtrListB.Add(cPrivilegeTypeB); } else { ObjectAtribute cPrivilegeType = new ObjectAtribute("Privilege type ", privB.Privilege_type, false); privAtrListA.Add(cPrivilegeType); privAtrListB.Add(cPrivilegeType); } } else { different = true; } }
public DbSyncConstraintDiff(Constraintt constAin, Constraintt constBin) { this.constA = constAin; this.constB = constBin; constraintAtributesListA = new List <ObjectAtribute>(); constraintAtributesListB = new List <ObjectAtribute>(); if (constA == null || constB == null) { if (constA != null) { this.constraintName = constA.Constraint_nam; constraintAtributesListA.Add(new ObjectAtribute("Constraint name ", constA.Constraint_nam, true)); constraintAtributesListA.Add(new ObjectAtribute("Constraint type ", constA.Constraint_typ, true)); constraintAtributesListA.Add(new ObjectAtribute("Initialy defered ", constA.Initialy_deferre.ToString(), true)); constraintAtributesListA.Add(new ObjectAtribute("Is deferable ", constA.Is_deferabl.ToString(), true)); constraintAtributesListA.Add(new ObjectAtribute("Condition ", constA.Condition, true)); foreach (string s in constA.Column) { constraintAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } } else if (constB != null) { this.constraintName = constB.Constraint_nam; constraintAtributesListB.Add(new ObjectAtribute("Constraint name ", constB.Constraint_nam, true)); constraintAtributesListB.Add(new ObjectAtribute("Constraint type ", constB.Constraint_typ, true)); constraintAtributesListB.Add(new ObjectAtribute("Initialy defered ", constB.Initialy_deferre.ToString(), true)); constraintAtributesListB.Add(new ObjectAtribute("Is deferable ", constB.Is_deferabl.ToString(), true)); constraintAtributesListB.Add(new ObjectAtribute("Condition ", constB.Condition, true)); foreach (string s in constB.Column) { constraintAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else { this.constraintName = "UNDEFINED"; } } if (constA != null && constB != null) { this.constraintName = constA.Constraint_nam; if (constA.Constraint_nam != constB.Constraint_nam) { diffConstraintName = true; } if (constA.Constraint_typ != constB.Constraint_typ) { diffConstraintType = true; } if (constA.Initialy_deferre != constB.Initialy_deferre) { diffInitialyDefered = true; } if (constA.Is_deferabl != constB.Is_deferabl) { diffIsDeferable = true; } if (constA.Condition != constB.Condition) { diffCondition = true; } if (!CompareColumns(constA.Column, constB.Column)) { diffColumns = true; } if (diffConstraintName || diffConstraintType || diffInitialyDefered || diffIsDeferable || diffCondition || diffColumns) { different = true; } else { different = false; } ObjectAtribute cName = new ObjectAtribute("Constraint name ", constA.Constraint_nam, false); if (diffConstraintType) { ObjectAtribute cTypeA = new ObjectAtribute("Constraint type ", constA.Constraint_typ, true); constraintAtributesListA.Add(cTypeA); ObjectAtribute cTypeB = new ObjectAtribute("Constraint type ", constB.Constraint_typ, true); constraintAtributesListB.Add(cTypeB); } else { ObjectAtribute cType = new ObjectAtribute("Constraint type ", constA.Constraint_typ, false); constraintAtributesListA.Add(cType); constraintAtributesListB.Add(cType); } if (diffInitialyDefered) { ObjectAtribute cdeferedA = new ObjectAtribute("Initialy defered ", constA.Initialy_deferre.ToString(), true); constraintAtributesListA.Add(cdeferedA); ObjectAtribute cdeferedB = new ObjectAtribute("Initialy defered ", constB.Initialy_deferre.ToString(), true); constraintAtributesListB.Add(cdeferedB); } else { ObjectAtribute cdefered = new ObjectAtribute("Initialy defered ", constA.Initialy_deferre.ToString(), false); constraintAtributesListA.Add(cdefered); constraintAtributesListB.Add(cdefered); } if (diffIsDeferable) { ObjectAtribute cDeferableA = new ObjectAtribute("Deferable ", constA.Is_deferabl.ToString(), true); constraintAtributesListA.Add(cDeferableA); ObjectAtribute cDeferableB = new ObjectAtribute("Deferable ", constB.Is_deferabl.ToString(), true); constraintAtributesListB.Add(cDeferableB); } else { ObjectAtribute cDeferable = new ObjectAtribute("Deferable ", constA.Is_deferabl.ToString(), false); constraintAtributesListA.Add(cDeferable); constraintAtributesListB.Add(cDeferable); } if (diffCondition) { constraintAtributesListA.Add(new ObjectAtribute("Condition ", constA.Condition, true)); constraintAtributesListB.Add(new ObjectAtribute("Condition ", constB.Condition, true)); } else { constraintAtributesListA.Add(new ObjectAtribute("Condition ", constA.Condition, false)); constraintAtributesListB.Add(new ObjectAtribute("Condition ", constB.Condition, false)); } if (diffColumns) { foreach (string s in constA.Column) { constraintAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } foreach (string s in constB.Column) { constraintAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else { foreach (string s in constA.Column) { constraintAtributesListA.Add(new ObjectAtribute("Column ", s, false)); constraintAtributesListB.Add(new ObjectAtribute("Column ", s, false)); } } } else { different = true; } }
public DbSyncConstraintDiff(Constraintt constAin, Constraintt constBin) { this.constA = constAin; this.constB = constBin; constraintAtributesListA = new List<ObjectAtribute>(); constraintAtributesListB = new List<ObjectAtribute>(); if (constA == null || constB == null) { if (constA != null) { this.constraintName = constA.Constraint_nam; constraintAtributesListA.Add(new ObjectAtribute("Constraint name ", constA.Constraint_nam, true)); constraintAtributesListA.Add(new ObjectAtribute("Constraint type ", constA.Constraint_typ, true)); constraintAtributesListA.Add(new ObjectAtribute("Initialy defered ", constA.Initialy_deferre.ToString(), true)); constraintAtributesListA.Add(new ObjectAtribute("Is deferable ", constA.Is_deferabl.ToString(), true)); constraintAtributesListA.Add(new ObjectAtribute("Condition ", constA.Condition, true)); foreach (string s in constA.Column) { constraintAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } } else if (constB != null) { this.constraintName = constB.Constraint_nam; constraintAtributesListB.Add(new ObjectAtribute("Constraint name ", constB.Constraint_nam, true)); constraintAtributesListB.Add(new ObjectAtribute("Constraint type ", constB.Constraint_typ, true)); constraintAtributesListB.Add(new ObjectAtribute("Initialy defered ", constB.Initialy_deferre.ToString(), true)); constraintAtributesListB.Add(new ObjectAtribute("Is deferable ", constB.Is_deferabl.ToString(), true)); constraintAtributesListB.Add(new ObjectAtribute("Condition ", constB.Condition, true)); foreach (string s in constB.Column) { constraintAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else this.constraintName = "UNDEFINED"; } if (constA != null && constB != null) { this.constraintName = constA.Constraint_nam; if (constA.Constraint_nam != constB.Constraint_nam) diffConstraintName = true; if (constA.Constraint_typ != constB.Constraint_typ) diffConstraintType = true; if (constA.Initialy_deferre != constB.Initialy_deferre) diffInitialyDefered = true; if (constA.Is_deferabl != constB.Is_deferabl) diffIsDeferable = true; if (constA.Condition != constB.Condition) diffCondition = true; if (!CompareColumns(constA.Column,constB.Column)) diffColumns = true; if (diffConstraintName || diffConstraintType || diffInitialyDefered || diffIsDeferable||diffCondition||diffColumns) different = true; else different = false; ObjectAtribute cName = new ObjectAtribute("Constraint name ", constA.Constraint_nam, false); if (diffConstraintType) { ObjectAtribute cTypeA = new ObjectAtribute("Constraint type ", constA.Constraint_typ, true); constraintAtributesListA.Add(cTypeA); ObjectAtribute cTypeB = new ObjectAtribute("Constraint type ", constB.Constraint_typ, true); constraintAtributesListB.Add(cTypeB); } else { ObjectAtribute cType = new ObjectAtribute("Constraint type ", constA.Constraint_typ, false); constraintAtributesListA.Add(cType); constraintAtributesListB.Add(cType); } if (diffInitialyDefered) { ObjectAtribute cdeferedA = new ObjectAtribute("Initialy defered ", constA.Initialy_deferre.ToString(), true); constraintAtributesListA.Add(cdeferedA); ObjectAtribute cdeferedB = new ObjectAtribute("Initialy defered ", constB.Initialy_deferre.ToString(), true); constraintAtributesListB.Add(cdeferedB); } else { ObjectAtribute cdefered = new ObjectAtribute("Initialy defered ", constA.Initialy_deferre.ToString(), false); constraintAtributesListA.Add(cdefered); constraintAtributesListB.Add(cdefered); } if (diffIsDeferable) { ObjectAtribute cDeferableA = new ObjectAtribute("Deferable ", constA.Is_deferabl.ToString(), true); constraintAtributesListA.Add(cDeferableA); ObjectAtribute cDeferableB = new ObjectAtribute("Deferable ", constB.Is_deferabl.ToString(), true); constraintAtributesListB.Add(cDeferableB); } else { ObjectAtribute cDeferable = new ObjectAtribute("Deferable ", constA.Is_deferabl.ToString(), false); constraintAtributesListA.Add(cDeferable); constraintAtributesListB.Add(cDeferable); } if (diffCondition) { constraintAtributesListA.Add(new ObjectAtribute("Condition ", constA.Condition, true)); constraintAtributesListB.Add(new ObjectAtribute("Condition ", constB.Condition, true)); } else { constraintAtributesListA.Add(new ObjectAtribute("Condition ", constA.Condition, false)); constraintAtributesListB.Add(new ObjectAtribute("Condition ", constB.Condition, false)); } if (diffColumns) { foreach (string s in constA.Column) { constraintAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } foreach (string s in constB.Column) { constraintAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else { foreach (string s in constA.Column) { constraintAtributesListA.Add(new ObjectAtribute("Column ", s, false)); constraintAtributesListB.Add(new ObjectAtribute("Column ", s, false)); } } } else different = true; }
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; } }
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 DbSyncIndexDiff(Index indexAin, Index indexBin) { this.indexA = indexAin; this.indexB = indexBin; indexAtributesListA = new List <ObjectAtribute>(); indexAtributesListB = new List <ObjectAtribute>(); if (indexA == null || indexB == null) { if (indexA != null) { nameOfIndex = indexA.Name; indexAtributesListA.Add(new ObjectAtribute("Index name", indexA.Name, true)); indexAtributesListA.Add(new ObjectAtribute("Index type", indexA.Type, true)); indexAtributesListA.Add(new ObjectAtribute("Is unique", indexA.Unique.ToString(), true)); foreach (string s in indexA.Columns) { indexAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } } else if (indexB != null) { nameOfIndex = indexB.Name; indexAtributesListB.Add(new ObjectAtribute("Index name", indexB.Name, true)); indexAtributesListB.Add(new ObjectAtribute("Index type", indexB.Type, true)); indexAtributesListB.Add(new ObjectAtribute("Is unique", indexB.Unique.ToString(), true)); foreach (string s in indexB.Columns) { indexAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else { nameOfIndex = "UNDEFINED"; } } if (indexA != null && indexB != null) { nameOfIndex = indexA.Name; if (indexA.Name != indexB.Name) { diffindexName = true; } if (indexA.Type != indexB.Type) { diffindexType = true; } if (indexA.Unique != indexB.Unique) { diffIndexUnique = true; } if (!CompareColumns(indexA.Columns, indexB.Columns)) { diffColumns = true; } if (diffindexName || diffindexType || diffIndexUnique) { different = true; } else { different = false; } ObjectAtribute Iname = new ObjectAtribute("Index name", indexA.Name, false); indexAtributesListA.Add(Iname); indexAtributesListB.Add(Iname); if (diffindexType) { ObjectAtribute ItypeA = new ObjectAtribute("Index type ", indexA.Type, true); indexAtributesListA.Add(ItypeA); ObjectAtribute ItypeB = new ObjectAtribute("Index type ", indexB.Type, true); indexAtributesListB.Add(ItypeB); } else { ObjectAtribute Itype = new ObjectAtribute("Index type ", indexA.Type, false); indexAtributesListA.Add(Itype); indexAtributesListB.Add(Itype); } if (diffIndexUnique) { ObjectAtribute IuniqueA = new ObjectAtribute("Is unique ", indexA.Unique.ToString(), true); indexAtributesListA.Add(IuniqueA); ObjectAtribute IuniqueB = new ObjectAtribute("Is unique ", indexB.Unique.ToString(), true); indexAtributesListB.Add(IuniqueB); } else { ObjectAtribute Iunique = new ObjectAtribute("Is unique ", indexA.Unique.ToString(), false); indexAtributesListA.Add(Iunique); indexAtributesListB.Add(Iunique); } if (diffColumns) { foreach (string s in indexA.Columns) { indexAtributesListA.Add(new ObjectAtribute("Column ", s, true)); } foreach (string s in indexB.Columns) { indexAtributesListB.Add(new ObjectAtribute("Column ", s, true)); } } else { foreach (string s in indexA.Columns) { indexAtributesListB.Add(new ObjectAtribute("Column ", s, false)); indexAtributesListA.Add(new ObjectAtribute("Column ", s, false)); } } } else { different = true; } }
public DbSyncPrivilegeDiff(Privilege privAin, Privilege privBin) { this.privA = privAin; this.privB = privBin; privAtrListA = new List<ObjectAtribute>(); privAtrListB = new List<ObjectAtribute>(); if (privA == null || privB == null) { if (privA != null) { this.privilegeName = privA.Grantee + " " + privA.Privilege_type; privAtrListA.Add(new ObjectAtribute("Object name", privA.Table_name, true)); privAtrListA.Add(new ObjectAtribute("Grantee", privA.Grantee, true)); //privAtrListA.Add(new ObjectAtribute("Is Grantable", privA.Is_grantable.ToString(), true)); privAtrListA.Add(new ObjectAtribute("Privilege type", privA.Privilege_type, true)); } else if (privB != null) { this.privilegeName = privB.Grantee + " " + privB.Privilege_type; privAtrListB.Add(new ObjectAtribute("Object name", privB.Table_name, true)); privAtrListB.Add(new ObjectAtribute("Grantee", privB.Grantee, true)); //privAtrListB.Add(new ObjectAtribute("Is Grantable", privB.Is_grantable.ToString(), true)); privAtrListB.Add(new ObjectAtribute("Privilege type", privB.Privilege_type, true)); } else this.privilegeName = "UNDEFINED"; } if (privA != null && privB != null) { this.privilegeName = privA.Grantee + " " + privA.Privilege_type; if (privA.Grantee != privB.Grantee) diffGrantee = true; //if (privA.Is_grantable != privB.Is_grantable) diffISGrantable = true; if (privA.Table_name != privB.Table_name) diffTableNAme = true; if (privA.Privilege_type != privB.Privilege_type) diffprivilegeType = true; if (diffGrantee || diffISGrantable || diffprivilegeType || diffTableNAme) different = true; else different = false; ObjectAtribute cObjectname = new ObjectAtribute("Object name ", privA.Table_name, false); privAtrListA.Add(cObjectname); privAtrListB.Add(cObjectname); if (diffGrantee) { ObjectAtribute cGranteA = new ObjectAtribute("Grantee ", privA.Grantee, true); privAtrListA.Add(cGranteA); ObjectAtribute cGranteB = new ObjectAtribute("Grantee ", privB.Grantee, true); privAtrListB.Add(cGranteB); } else { ObjectAtribute cGrantee = new ObjectAtribute("Grantee ", privB.Grantee, false); privAtrListA.Add(cGrantee); privAtrListB.Add(cGrantee); } /*if (diffISGrantable) { ObjectAtribute cIsGrantableA = new ObjectAtribute("Is Grantable ", privA.Is_grantable.ToString(), true); privAtrListA.Add(cIsGrantableA); ObjectAtribute cIsGrantableB = new ObjectAtribute("Is Grantable ", privB.Is_grantable.ToString(), true); privAtrListB.Add(cIsGrantableB); } else { ObjectAtribute cIsGrantable = new ObjectAtribute("Is Grantable ", privB.Is_grantable.ToString(), false); privAtrListA.Add(cIsGrantable); privAtrListB.Add(cIsGrantable); } */ if (diffprivilegeType) { ObjectAtribute cPrivilegeTypeA = new ObjectAtribute("Privilege type ", privA.Privilege_type, true); privAtrListA.Add(cPrivilegeTypeA); ObjectAtribute cPrivilegeTypeB = new ObjectAtribute("Privilege type ", privB.Privilege_type, true); privAtrListB.Add(cPrivilegeTypeB); } else { ObjectAtribute cPrivilegeType = new ObjectAtribute("Privilege type ", privB.Privilege_type, false); privAtrListA.Add(cPrivilegeType); privAtrListB.Add(cPrivilegeType); } } else different = true; }
public DbSyncTypeDiff(Typ typeAin, Typ typeBin) { this.typeA = typeAin; this.typeB = typeBin; typeAtributesA = new List<ObjectAtribute>(); typeAtributesB = new List<ObjectAtribute>(); if (typeA == null || typeB == null) { if (typeA != null) { typeName = typeA.Nazov; typeAtributesA.Add(new ObjectAtribute("Name of type", typeName, true)); typeAtributesA.Add(new ObjectAtribute("Type datatype ", typeA.Datatyp, true)); typeAtributesA.Add(new ObjectAtribute("Type precision ", typeA.Precision, true)); typeAtributesA.Add(new ObjectAtribute("Type scale ", typeA.Scale, true)); typeAtributesA.Add(new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), true)); } else if (typeB != null) { typeName = typeB.Nazov; typeAtributesB.Add(new ObjectAtribute("Name of type", typeName, true)); typeAtributesA.Add(new ObjectAtribute("Type datatype ", typeB.Datatyp, true)); typeAtributesA.Add(new ObjectAtribute("Type precision ", typeB.Precision, true)); typeAtributesA.Add(new ObjectAtribute("Type scale ", typeB.Scale, true)); typeAtributesA.Add(new ObjectAtribute("Type Is Nullable ", typeB.CanBeNull.ToString(), true)); } else typeName = "UNDEFINED"; } if (typeA != null && typeB != null) { if (typeA.Datatyp != typeB.Datatyp) diffTypeDatatype = true; if (typeA.Precision != typeB.Precision) diffPrecision = true; if (typeA.Scale != typeB.Scale) diffScale = true; if (typeA.CanBeNull != typeB.CanBeNull) diffCanBeNull = true; if (typeA.Nazov != typeB.Nazov) diffTypeNAme = true; if (diffPrecision || diffScale || diffTypeDatatype || diffTypeNAme || diffCanBeNull) different = true; else different = false; typeName = typeA.Nazov; typeAtributesA.Add (new ObjectAtribute("Name of type",typeName,false)); typeAtributesB.Add (new ObjectAtribute("Name of type",typeName,false)); if (diffPrecision) { ObjectAtribute tcharA = new ObjectAtribute("Type precision ", typeA.Precision, true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Type precision ", typeB.Precision, true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Type precision ", typeA.Precision, false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } if (diffScale) { ObjectAtribute tcharA = new ObjectAtribute("Type scale ", typeA.Scale, true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Type scale ", typeB.Scale, true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Type scale ", typeA.Scale, false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } if (diffTypeDatatype) { ObjectAtribute tcharA = new ObjectAtribute("Datatype ", typeA.Datatyp, true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Datatype ", typeB.Datatyp, true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Datatype ", typeA.Datatyp, false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } if (diffCanBeNull) { ObjectAtribute tcharA = new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), true); typeAtributesA.Add(tcharA); ObjectAtribute tcharB = new ObjectAtribute("Type Is Nullable ", typeB.CanBeNull.ToString(), true); typeAtributesB.Add(tcharB); } else { ObjectAtribute tchar = new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), false); typeAtributesA.Add(tchar); typeAtributesB.Add(tchar); } } else different = true; }
public DbSyncColumnDiff(Columnn columnAin, Columnn columnBin) { ColumnA = columnAin; ColumnB = columnBin; columnAtributesListA = new List <ObjectAtribute>(); columnAtributesListB = new List <ObjectAtribute>(); if (ColumnA == null || ColumnB == null) { if (ColumnA != null) { this.columnName = ColumnA.COULUMN_NAME1; columnAtributesListA.Add(new ObjectAtribute("Name of column", ColumnA.COULUMN_NAME1, true)); columnAtributesListA.Add(new ObjectAtribute("Coulumn default", ColumnA.COULUMN_DEFAULT1, true)); columnAtributesListA.Add(new ObjectAtribute("Datatype", ColumnA.DATA_TYPE1, true)); columnAtributesListA.Add(new ObjectAtribute("Date Time Precision", ColumnA.DATETIME_PRECISION1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set catalog", ColumnA.CHARACTER_SET_CATALOG1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set name", ColumnA.CHARACTER_SET_NAME1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set schema", ColumnA.CHARACTER_SET_SCHEMA1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character max length", ColumnA.CHARACTER_MAXIMUM_LENGTH1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character octet length", ColumnA.CHARACTER_OCTET_LENGTH1, true)); columnAtributesListA.Add(new ObjectAtribute("Is nullable", ColumnA.IS_NULLABLE1, true)); columnAtributesListA.Add(new ObjectAtribute("Numeric precision", ColumnA.NUMERIC_PRECISION1, true)); columnAtributesListA.Add(new ObjectAtribute("Numeric scale", ColumnA.NUMERIC_SCALE1, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of fk Column", ColumnA.FK_NameOFPKCol, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of fk Tab", ColumnA.FK_nameOFPKTab, true)); //columnAtributesListA.Add(new ObjectAtribute("Is forein Key", ColumnA.Is_foreinKey().ToString(), true)); //columnAtributesListA.Add(new ObjectAtribute("Is primary Key", ColumnA.Is_primaryKey().ToString(), true)); //columnAtributesListA.Add(new ObjectAtribute("Name of Fk", ColumnA.Name_of_FK, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of pk", ColumnA.Name_of_PK, true)); } else if (ColumnB != null) { this.columnName = ColumnB.COULUMN_NAME1; columnAtributesListB.Add(new ObjectAtribute("Name of column", ColumnB.COULUMN_NAME1, true)); columnAtributesListB.Add(new ObjectAtribute("Coulumn default", ColumnB.COULUMN_DEFAULT1, true)); columnAtributesListB.Add(new ObjectAtribute("Datatype", ColumnB.DATA_TYPE1, true)); columnAtributesListB.Add(new ObjectAtribute("Date Time Precision", ColumnB.DATETIME_PRECISION1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set catalog", ColumnB.CHARACTER_SET_CATALOG1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set name", ColumnB.CHARACTER_SET_NAME1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set schema", ColumnB.CHARACTER_SET_SCHEMA1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character max length", ColumnB.CHARACTER_MAXIMUM_LENGTH1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character octet length", ColumnB.CHARACTER_OCTET_LENGTH1, true)); columnAtributesListB.Add(new ObjectAtribute("Is nullable", ColumnB.IS_NULLABLE1, true)); columnAtributesListB.Add(new ObjectAtribute("Numeric precision", ColumnB.NUMERIC_PRECISION1, true)); columnAtributesListB.Add(new ObjectAtribute("Numeric scale", ColumnB.NUMERIC_SCALE1, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of fk Column", ColumnB.FK_NameOFPKCol, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of fk Tab", ColumnB.FK_nameOFPKTab, true)); //columnAtributesListB.Add(new ObjectAtribute("Is forein Key", ColumnB.Is_foreinKey().ToString(), true)); //columnAtributesListB.Add(new ObjectAtribute("Is primary Key", ColumnB.Is_primaryKey().ToString(), true)); //columnAtributesListB.Add(new ObjectAtribute("Name of Fk", ColumnB.Name_of_FK, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of pk", ColumnB.Name_of_PK, true)); } else { this.columnName = "UNDEFINED"; } } if (ColumnA != null && ColumnB != null) { this.columnName = ColumnA.COULUMN_NAME1; if (ColumnA.COULUMN_DEFAULT1 != ColumnB.COULUMN_DEFAULT1) { diffColumnDefault = true; } if (ColumnA.COULUMN_NAME1 != ColumnB.COULUMN_NAME1) { diffColumnName = true; } if (ColumnA.DATA_TYPE1 != ColumnB.DATA_TYPE1) { diffDatatype = true; } if (ColumnA.DATETIME_PRECISION1 != ColumnB.DATETIME_PRECISION1) { diffDatetimePrecision = true; } //if (ColumnA.FK_NameOFPKCol != ColumnB.FK_NameOFPKCol) diffFkNameOfPkCol = true; //if (ColumnA.FK_nameOFPKTab != ColumnB.FK_nameOFPKTab) diffFkNameOfPKTab = true; if (ColumnA.CHARACTER_MAXIMUM_LENGTH1 != ColumnB.CHARACTER_MAXIMUM_LENGTH1) { diffCharMaxLength = true; } //if (ColumnA.CHARACTER_OCTET_LENGTH1 != ColumnB.CHARACTER_OCTET_LENGTH1) diffCharOctetLength = true; //if (ColumnA.CHARACTER_SET_CATALOG1 != ColumnB.CHARACTER_SET_CATALOG1) diffCharacterSetCatalog = true; //if (ColumnA.CHARACTER_SET_NAME1 != ColumnB.CHARACTER_SET_NAME1) diffCharacterSetName = true; //if (ColumnA.CHARACTER_SET_SCHEMA1 != ColumnB.CHARACTER_SET_SCHEMA1) diffCharacterSetSchema = true; if (ColumnA.IS_NULLABLE1 != ColumnB.IS_NULLABLE1) { diffIsNullable = true; } //if (ColumnA.Name_of_FK != ColumnB.Name_of_FK) diffNameOfFK = true; //if (ColumnA.Name_of_PK != ColumnB.Name_of_PK) diffNameOfPk = true; //if (ColumnA.NazovStlpca != ColumnB.NazovStlpca) diffNameOfColumn = true; //if (ColumnA.NUMERIC_PRECISION_RADIX1 != ColumnB.NUMERIC_PRECISION_RADIX1) diffNumericPRecisionRadix = true; if (ColumnA.NUMERIC_PRECISION1 != ColumnB.NUMERIC_PRECISION1) { diffNumericPrecision = true; } if (ColumnA.NUMERIC_SCALE1 != ColumnB.NUMERIC_SCALE1) { diffNumericScale = true; } // if (ColumnA.ORDINAL_POSITION1 != ColumnB.ORDINAL_POSITION1) diffOrdinalPosition = true; //if (ColumnA.TABLE_NAME1 != ColumnB.TABLE_NAME1) diffTableName = true; //if (ColumnA.Is_foreinKey() != ColumnB.Is_foreinKey()) diffIsForeinKey = true; //if (ColumnA.Is_primaryKey() != ColumnB.Is_primaryKey()) diffIsPrimarykey = true; if (diffColumnDefault || diffColumnName || diffDatatype || diffDatetimePrecision || diffFkNameOfPkCol || diffFkNameOfPKTab || diffCharacterSetCatalog || diffCharacterSetName || diffCharacterSetSchema || diffCharMaxLength || diffCharOctetLength || diffIsForeinKey || diffIsNullable || diffIsPrimarykey || diffNameOfColumn || diffNameOfFK || diffNameOfPk || diffNumericPrecision || diffNumericScale) { different = true; } else { different = false; } //naplnenie zoznamu atributov pre potreby zobrazovania ObjectAtribute columnNameOA = new ObjectAtribute("Name of column", columnName, false); columnAtributesListA.Add(columnNameOA); columnAtributesListB.Add(columnNameOA); if (diffColumnDefault) { ObjectAtribute cDefaultA = new ObjectAtribute("Coulumn default ", ColumnA.COULUMN_DEFAULT1, true); columnAtributesListA.Add(cDefaultA); ObjectAtribute cDefaultB = new ObjectAtribute("Coulumn default ", ColumnB.COULUMN_DEFAULT1, true); columnAtributesListB.Add(cDefaultB); } else { ObjectAtribute cDefault = new ObjectAtribute("Coulumn default ", ColumnA.COULUMN_DEFAULT1, false); columnAtributesListA.Add(cDefault); columnAtributesListB.Add(cDefault); } if (diffDatatype) { ObjectAtribute cDatatypeA = new ObjectAtribute("Datatype ", ColumnA.DATA_TYPE1, true); columnAtributesListA.Add(cDatatypeA); ObjectAtribute cDatatypeB = new ObjectAtribute("Datatype ", ColumnB.DATA_TYPE1, true); columnAtributesListB.Add(cDatatypeB); } else { ObjectAtribute cDatatype = new ObjectAtribute("Datatype ", ColumnA.DATA_TYPE1, false); columnAtributesListA.Add(cDatatype); columnAtributesListB.Add(cDatatype); } if (diffDatetimePrecision) { ObjectAtribute cDateTimePrecisionA = new ObjectAtribute("Date Time Precision ", ColumnA.DATETIME_PRECISION1, true); columnAtributesListA.Add(cDateTimePrecisionA); ObjectAtribute cDateTimePrecisionB = new ObjectAtribute("Date Time Precision ", ColumnB.DATETIME_PRECISION1, true); columnAtributesListB.Add(cDateTimePrecisionB); } else { ObjectAtribute cDateTimePrecision = new ObjectAtribute("Date Time Precision ", ColumnA.DATETIME_PRECISION1, false); columnAtributesListA.Add(cDateTimePrecision); columnAtributesListB.Add(cDateTimePrecision); } //if (diffCharacterSetCatalog) //{ // ObjectAtribute cCheracterSetCatA = new ObjectAtribute("Character set catalog ", ColumnA.CHARACTER_SET_CATALOG1, true); // columnAtributesListA.Add(cCheracterSetCatA); // ObjectAtribute cCheracterSetCatB = new ObjectAtribute("Character set catalog ", ColumnB.CHARACTER_SET_CATALOG1, true); // columnAtributesListB.Add(cCheracterSetCatB); //} //else //{ // ObjectAtribute cCheracterSetCat = new ObjectAtribute("Character set catalog ", ColumnA.CHARACTER_SET_CATALOG1, false); // columnAtributesListA.Add(cCheracterSetCat); // columnAtributesListB.Add(cCheracterSetCat); //} //if (diffCharacterSetName) //{ // ObjectAtribute cCharacterSetNameA = new ObjectAtribute("Character set name ", ColumnA.CHARACTER_SET_NAME1, true); // columnAtributesListA.Add(cCharacterSetNameA); // ObjectAtribute cCharacterSetNameB = new ObjectAtribute("Character set name", ColumnB.CHARACTER_SET_NAME1, true); // columnAtributesListB.Add(cCharacterSetNameB); //} //else //{ // ObjectAtribute cCheracterSetCat = new ObjectAtribute("Character set name ", ColumnA.CHARACTER_SET_NAME1, false); // columnAtributesListA.Add(cCheracterSetCat); // columnAtributesListB.Add(cCheracterSetCat); //} //if (diffCharacterSetSchema) //{ // ObjectAtribute cCharacterSetSchemaA = new ObjectAtribute("Character set schema ", ColumnA.CHARACTER_SET_SCHEMA1, true); // columnAtributesListA.Add(cCharacterSetSchemaA); // ObjectAtribute cCharacterSetSchemaB = new ObjectAtribute("Character set schema", ColumnB.CHARACTER_SET_SCHEMA1, true); // columnAtributesListB.Add(cCharacterSetSchemaB); //} //else //{ // ObjectAtribute cCharacterSetSchema = new ObjectAtribute("Character set schema", ColumnA.CHARACTER_SET_SCHEMA1, false); // columnAtributesListA.Add(cCharacterSetSchema); // columnAtributesListB.Add(cCharacterSetSchema); //} if (diffCharMaxLength) { ObjectAtribute cCharacterMaxLEngthA = new ObjectAtribute("Character max length ", ColumnA.CHARACTER_MAXIMUM_LENGTH1, true); columnAtributesListA.Add(cCharacterMaxLEngthA); ObjectAtribute cCharacterMaxLEngthB = new ObjectAtribute("Character max length ", ColumnB.CHARACTER_MAXIMUM_LENGTH1, true); columnAtributesListB.Add(cCharacterMaxLEngthB); } else { ObjectAtribute cCharacterMaxLEngth = new ObjectAtribute("Character max length ", ColumnA.CHARACTER_MAXIMUM_LENGTH1, false); columnAtributesListA.Add(cCharacterMaxLEngth); columnAtributesListB.Add(cCharacterMaxLEngth); } // if (diffCharOctetLength) //{ // ObjectAtribute cCharacterOctetLEngthA = new ObjectAtribute("Character octet length ", ColumnA.CHARACTER_OCTET_LENGTH1, true); // columnAtributesListA.Add(cCharacterOctetLEngthA); // ObjectAtribute cCharacterOctetLEngthB = new ObjectAtribute("Character octet length ", ColumnB.CHARACTER_OCTET_LENGTH1, true); // columnAtributesListB.Add(cCharacterOctetLEngthB); //} //else //{ // ObjectAtribute cCharacterOctetLEngth = new ObjectAtribute("Character octet length ", ColumnA.CHARACTER_OCTET_LENGTH1, false); // columnAtributesListA.Add(cCharacterOctetLEngth); // columnAtributesListB.Add(cCharacterOctetLEngth); //} if (diffIsNullable) { ObjectAtribute cIsNullableA = new ObjectAtribute("Is nullable ", ColumnA.IS_NULLABLE1, true); columnAtributesListA.Add(cIsNullableA); ObjectAtribute cIsNullableB = new ObjectAtribute("Is nullable ", ColumnB.IS_NULLABLE1, true); columnAtributesListB.Add(cIsNullableB); } else { ObjectAtribute cIsNullable = new ObjectAtribute("Is nullable", ColumnA.IS_NULLABLE1, false); columnAtributesListA.Add(cIsNullable); columnAtributesListB.Add(cIsNullable); } if (diffNumericPrecision) { ObjectAtribute cNumericPrecisionA = new ObjectAtribute("Numeric precision ", ColumnA.NUMERIC_PRECISION1, true); columnAtributesListA.Add(cNumericPrecisionA); ObjectAtribute cNumericPrecisionB = new ObjectAtribute("Numeric precision ", ColumnB.NUMERIC_PRECISION1, true); columnAtributesListB.Add(cNumericPrecisionB); } else { ObjectAtribute cNumericPrecision = new ObjectAtribute("Numeric precision ", ColumnA.NUMERIC_PRECISION1, false); columnAtributesListA.Add(cNumericPrecision); columnAtributesListB.Add(cNumericPrecision); } if (diffNumericScale) { ObjectAtribute cNumericScaleA = new ObjectAtribute("Numeric scale ", ColumnA.NUMERIC_SCALE1, true); columnAtributesListA.Add(cNumericScaleA); ObjectAtribute cNumericScaleB = new ObjectAtribute("Numeric scale", ColumnB.NUMERIC_SCALE1, true); columnAtributesListB.Add(cNumericScaleB); } else { ObjectAtribute cNumericScale = new ObjectAtribute("Numeric scale", ColumnA.NUMERIC_SCALE1, false); columnAtributesListA.Add(cNumericScale); columnAtributesListB.Add(cNumericScale); } //if (diffFkNameOfPkCol) //{ // ObjectAtribute cNameOfPkColA = new ObjectAtribute("Name of fk Column ", ColumnA.FK_NameOFPKCol, true); // columnAtributesListA.Add(cNameOfPkColA); // ObjectAtribute cNameOfPkColB = new ObjectAtribute("Name of fk Column ", ColumnB.FK_NameOFPKCol, true); // columnAtributesListB.Add(cNameOfPkColB); //} //else //{ // ObjectAtribute cNameOfPkCol = new ObjectAtribute("Name of fk Column ", ColumnA.FK_NameOFPKCol, false); // columnAtributesListA.Add(cNameOfPkCol); // columnAtributesListB.Add(cNameOfPkCol); //} //if (diffFkNameOfPKTab) //{ // ObjectAtribute cNameOfPkTabA = new ObjectAtribute("Name of fk Tab ", ColumnA.FK_nameOFPKTab, true); // columnAtributesListA.Add(cNameOfPkTabA); // ObjectAtribute cNameOfPkTabB = new ObjectAtribute("Name of fk Tab ", ColumnB.FK_nameOFPKTab, true); // columnAtributesListB.Add(cNameOfPkTabB); //} //else //{ // ObjectAtribute cNameOfPkTab = new ObjectAtribute("Name of fk Tab ", ColumnA.FK_nameOFPKTab, false); // columnAtributesListA.Add(cNameOfPkTab); // columnAtributesListB.Add(cNameOfPkTab); //} //if (diffIsForeinKey) //{ // ObjectAtribute cIsForeinKeyA = new ObjectAtribute("Is forein Key ", ColumnA.Is_foreinKey().ToString(), true); // columnAtributesListA.Add(cIsForeinKeyA); // ObjectAtribute cIsForeinKeyB = new ObjectAtribute("Is forein Key ", ColumnB.Is_foreinKey().ToString(), true); // columnAtributesListB.Add(cIsForeinKeyB); //} //else //{ // ObjectAtribute cIsForeinKey = new ObjectAtribute("Is forein Key ", ColumnA.Is_foreinKey().ToString(), false); // columnAtributesListA.Add(cIsForeinKey); // columnAtributesListB.Add(cIsForeinKey); //} //if (diffIsPrimarykey) //{ // ObjectAtribute cIsPrimaryKeyA = new ObjectAtribute("Is primary Key ", ColumnA.Is_primaryKey().ToString(), true); // columnAtributesListA.Add(cIsPrimaryKeyA); // ObjectAtribute cIsPrimaryKeyB = new ObjectAtribute("Is primary Key ", ColumnB.Is_primaryKey().ToString(), true); // columnAtributesListB.Add(cIsPrimaryKeyB); //} //else //{ // ObjectAtribute cIsPrimaryKey = new ObjectAtribute("Is primary Key ", ColumnA.Is_primaryKey().ToString(), false); // columnAtributesListA.Add(cIsPrimaryKey); // columnAtributesListB.Add(cIsPrimaryKey); //} //if (diffNameOfFK) //{ // ObjectAtribute cNameOfFkA = new ObjectAtribute("Name of Fk ", ColumnA.Name_of_FK, true); // columnAtributesListA.Add(cNameOfFkA); // ObjectAtribute cNameOfFkB = new ObjectAtribute("Name of Fk ", ColumnB.Name_of_FK, true); // columnAtributesListB.Add(cNameOfFkB); //} //else //{ // ObjectAtribute cNameOfFk = new ObjectAtribute("Name of Fk ", ColumnA.Name_of_FK, false); // columnAtributesListA.Add(cNameOfFk); // columnAtributesListB.Add(cNameOfFk); //} //if (diffNameOfPk) //{ // ObjectAtribute cNameOfPkA = new ObjectAtribute("Name of pk ", ColumnA.Name_of_PK, true); // columnAtributesListA.Add(cNameOfPkA); // ObjectAtribute cNameOfPkB = new ObjectAtribute("Name of pk ", ColumnB.Name_of_PK, true); // columnAtributesListB.Add(cNameOfPkB); //} //else //{ // ObjectAtribute cNameOfPk = new ObjectAtribute("Name of pk ", ColumnA.Name_of_PK, false); // columnAtributesListA.Add(cNameOfPk); // columnAtributesListB.Add(cNameOfPk); //} } else { different = true; } }
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; }