private List <IPlanStep> GetDeleteSteps(DeleteStatement statement) { var result = new List <IPlanStep>(); var step = new DeleteStep(); step.DatabaseName = statement.DatabaseName; step.TableName = statement.Tables.First(); if (statement.HasWhereClause) { // need to delete only the rows in the where clause step.InputStep = QueryPlanGeneratorUtility.GetMaxStep(_plan.Steps); step.Level = step.InputStep.Level++; var rows = step.InputStep.GetResult(_process, statement.DatabaseName).Rows; step.DeletedRows = rows; } else { // delete everything step.ShouldDeleteAllRows = true; } result.Add(step); return(result); }
// TO DO: We need to figure out how to input the rows we wish to affect private List <IPlanStep> GetUpdateSteps(UpdateStatement statement, List <IPlanStep> existingSteps) { var result = new List <IPlanStep>(); foreach (var element in statement.Elements) { var step = new UpdateStep(); if (statement.HasWhereClause) { step.InputStep = QueryPlanGeneratorUtility.GetMaxStep(existingSteps); } step.TableName = element.TableName; step.DatabaseName = element.DatabaseName; step.ColumnName = element.ColumnName; step.Value = element.Value; _level++; step.Level = _level; result.Add(step); } return(result); }