public int Update(Session session, Table table, RowSetNavigatorDataChange navigator) { int size = navigator.GetSize(); for (int i = 0; i < size; i++) { navigator.Next(); object[] currentChangedData = navigator.GetCurrentChangedData(); table.SetIdentityColumn(session, currentChangedData); table.SetGeneratedColumns(session, currentChangedData); } navigator.BeforeFirst(); if (table.FkMainConstraints.Length != 0) { HashSet <object> constraintPath = session.sessionContext.GetConstraintPath(); for (int k = 0; k < size; k++) { Row nextRow = navigator.GetNextRow(); object[] currentChangedData = navigator.GetCurrentChangedData(); PerformReferentialActions(session, table, navigator, nextRow, currentChangedData, base.UpdateColumnMap, constraintPath); constraintPath.Clear(); } navigator.BeforeFirst(); } for (int j = 0; j < navigator.GetSize(); j++) { Row nextRow = navigator.GetNextRow(); object[] currentChangedData = navigator.GetCurrentChangedData(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); Table table2 = (Table)nextRow.GetTable(); if (table2.TriggerLists[8].Length != 0) { table2.FireTriggers(session, 8, nextRow.RowData, currentChangedData, currentChangedColumns); table2.EnforceRowConstraints(session, currentChangedData); } } if (!table.IsView()) { navigator.BeforeFirst(); for (int k = 0; k < navigator.GetSize(); k++) { Row nextRow = navigator.GetNextRow(); Table table3 = (Table)nextRow.GetTable(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); session.AddDeleteAction(table3, nextRow, currentChangedColumns); } navigator.BeforeFirst(); for (int m = 0; m < navigator.GetSize(); m++) { object[] currentChangedData = navigator.GetCurrentChangedData(); Table table4 = (Table)navigator.GetNextRow().GetTable(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); IPersistentStore rowStore = table4.GetRowStore(session); if (currentChangedData != null) { table4.InsertSingleRow(session, rowStore, currentChangedData, currentChangedColumns); } } navigator.BeforeFirst(); OrderedHashSet <Table> set2 = null; bool flag = table.TriggerLists[5].Length > 0; for (int n = 0; n < navigator.GetSize(); n++) { Row nextRow = navigator.GetNextRow(); Table table5 = (Table)nextRow.GetTable(); object[] currentChangedData = navigator.GetCurrentChangedData(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); PerformIntegrityChecks(session, table5, nextRow.RowData, currentChangedData, currentChangedColumns); if (table5 != table) { if (set2 == null) { set2 = new OrderedHashSet <Table>(); } set2.Add(table5); if (table5.TriggerLists[5].Length != 0) { flag = true; } } } navigator.BeforeFirst(); if (flag) { for (int num9 = 0; num9 < navigator.GetSize(); num9++) { Row nextRow = navigator.GetNextRow(); object[] currentChangedData = navigator.GetCurrentChangedData(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); ((Table)nextRow.GetTable()).FireTriggers(session, 5, nextRow.RowData, currentChangedData, currentChangedColumns); } navigator.BeforeFirst(); } base.BaseTable.FireTriggers(session, 2, navigator); if (set2 != null) { for (int num10 = 0; num10 < set2.Size(); num10++) { set2.Get(num10).FireTriggers(session, 2, navigator); } } } return(size); }
public static int Delete(Session session, Table table, RowSetNavigatorDataChange navigator) { int size = navigator.GetSize(); navigator.BeforeFirst(); if (table.FkMainConstraints.Length != 0) { HashSet <object> constraintPath = session.sessionContext.GetConstraintPath(); for (int i = 0; i < size; i++) { navigator.Next(); Row currentRow = navigator.GetCurrentRow(); PerformReferentialActions(session, table, navigator, currentRow, null, null, constraintPath); constraintPath.Clear(); } navigator.BeforeFirst(); } while (navigator.HasNext()) { navigator.Next(); Row currentRow = navigator.GetCurrentRow(); object[] currentChangedData = navigator.GetCurrentChangedData(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); Table table2 = (Table)currentRow.GetTable(); if (currentChangedData == null) { table2.FireTriggers(session, 7, currentRow.RowData, null, null); } else { table2.FireTriggers(session, 8, currentRow.RowData, currentChangedData, currentChangedColumns); } } if (!table.IsView()) { navigator.BeforeFirst(); bool flag = false; for (int i = 0; i < navigator.GetSize(); i++) { Row nextRow = navigator.GetNextRow(); Table table3 = (Table)nextRow.GetTable(); session.AddDeleteAction(table3, nextRow, null); if (navigator.GetCurrentChangedData() != null) { flag = true; } } navigator.BeforeFirst(); if (flag) { for (int j = 0; j < navigator.GetSize(); j++) { object[] currentChangedData = navigator.GetCurrentChangedData(); Table table4 = (Table)navigator.GetNextRow().GetTable(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); IPersistentStore rowStore = table4.GetRowStore(session); if (currentChangedData != null) { table4.InsertSingleRow(session, rowStore, currentChangedData, currentChangedColumns); } } navigator.BeforeFirst(); } OrderedHashSet <Table> set2 = null; OrderedHashSet <Table> set3 = null; bool flag2 = table.TriggerLists[4].Length > 0; if (size != navigator.GetSize()) { while (navigator.HasNext()) { navigator.Next(); Row currentRow = navigator.GetCurrentRow(); object[] currentChangedData = navigator.GetCurrentChangedData(); int[] currentChangedColumns = navigator.GetCurrentChangedColumns(); Table table5 = (Table)currentRow.GetTable(); if (currentChangedData != null) { PerformIntegrityChecks(session, table5, currentRow.RowData, currentChangedData, currentChangedColumns); } if (table5 != table) { if (currentChangedData == null) { if (table5.TriggerLists[4].Length != 0) { flag2 = true; } if (set3 == null) { set3 = new OrderedHashSet <Table>(); } set3.Add(table5); } else { if (table5.TriggerLists[5].Length != 0) { flag2 = true; } if (set2 == null) { set2 = new OrderedHashSet <Table>(); } set2.Add(table5); } } } navigator.BeforeFirst(); } if (flag2) { while (navigator.HasNext()) { navigator.Next(); Row currentRow = navigator.GetCurrentRow(); object[] currentChangedData = navigator.GetCurrentChangedData(); Table table6 = (Table)currentRow.GetTable(); if (currentChangedData == null) { table6.FireTriggers(session, 4, currentRow.RowData, null, null); } else { table6.FireTriggers(session, 5, currentRow.RowData, currentChangedData, null); } } navigator.BeforeFirst(); } table.FireTriggers(session, 1, navigator); if (set2 != null) { for (int j = 0; j < set2.Size(); j++) { set2.Get(j).FireTriggers(session, 2, navigator); } } if (set3 != null) { for (int j = 0; j < set3.Size(); j++) { set3.Get(j).FireTriggers(session, 1, navigator); } } } return(size); }