//public static void FindUpdateColumnNames(string tableName, ConnectionData connData, out string updateByColumn, out bool updateByExists, out string updateDateColumn, out bool updateDateExists) //{ // string[] columns = SqlSync.DbInformation.InfoHelper.GetColumnNames(tableName,connData); // updateByColumn = SqlSync.DbInformation.InfoHelper.UpdateIdFields[0]; // updateByExists = false; // for(int i=0;i<columns.Length;i++) // { // for(int j=0;j<SqlSync.DbInformation.InfoHelper.UpdateIdFields.Length;j++) // { // if(columns[i].ToLower() == SqlSync.DbInformation.InfoHelper.UpdateIdFields[j].ToLower()) // { // updateByColumn = SqlSync.DbInformation.InfoHelper.UpdateIdFields[j]; // updateByExists = true; // break; // } // } // if(updateByExists) // break; // } // updateDateColumn = SqlSync.DbInformation.InfoHelper.UpdateDateFields[0]; // updateDateExists = false; // for(int i=0;i<columns.Length;i++) // { // for(int j=0;j<SqlSync.DbInformation.InfoHelper.UpdateDateFields.Length;j++) // { // if(columns[i].ToLower() == SqlSync.DbInformation.InfoHelper.UpdateDateFields[j].ToLower()) // { // updateDateColumn = SqlSync.DbInformation.InfoHelper.UpdateDateFields[j]; // updateDateExists = true; // break; // } // } // if(updateDateExists) // break; // } //} //public static void FindUpdateColumnNames(string tableName, ConnectionData connData, out string updateByColumn, out string updateDateColumn) //{ // bool notUsed1; // bool notUsed2; // FindUpdateColumnNames(tableName,connData,out updateByColumn,out notUsed1,out updateDateColumn,out notUsed2); //} public static UpdateAutoDetectData[] AutoDetectUpdateTriggers(ConnectionData connData, TableSize[] allTable) { string[] allTriggers = SqlSync.DbInformation.InfoHelper.GetTriggers(connData); ArrayList lst = new ArrayList(); for (int i = 0; i < allTriggers.Length; i++) { for (int j = 0; j < allTable.Length; j++) { //TODO: account for the . in the table name string table, schema; InfoHelper.ExtractNameAndSchema(allTable[j].TableName, out table, out schema); if (allTriggers[i] == String.Format(shortTrigFormat, table)) { UpdateAutoDetectData dat = new UpdateAutoDetectData(); dat.TableName = allTable[j].TableName; dat.RowCount = allTable[j].RowCount; dat.HasUpdateTrigger = true; lst.Add(dat); break; } } } UpdateAutoDetectData[] data = new UpdateAutoDetectData[lst.Count]; lst.CopyTo(data); return(data); }
public virtual bool Fill(UpdateAutoDetectData dataClass) { try { this.TableName = dataClass.TableName; this.RowCount = dataClass.RowCount; this.HasUpdateTrigger = dataClass.HasUpdateTrigger; return(true); } catch (System.Exception ex) { throw new System.ApplicationException("Error in the Auto-Generated: UpdateAutoDetectData.Fill(UpdateAutoDetectData) Method", ex); } }