public override IDataExecutionPlanNode FoldQuery(IDictionary <string, DataSource> dataSources, IQueryExecutionOptions options, IDictionary <string, Type> parameterTypes, IList <OptimizerHint> hints) { TrySource = TrySource.FoldQuery(dataSources, options, parameterTypes, hints); TrySource.Parent = this; CatchSource = CatchSource.FoldQuery(dataSources, options, parameterTypes, hints); CatchSource.Parent = this; return(this); }
public override INodeSchema GetSchema(IDictionary <string, DataSource> dataSources, IDictionary <string, Type> parameterTypes) { var trySchema = TrySource.GetSchema(dataSources, parameterTypes); var catchSchema = CatchSource.GetSchema(dataSources, parameterTypes); // Columns should be the same but sort order may be different if (trySchema.SortOrder.SequenceEqual(catchSchema.SortOrder, StringComparer.OrdinalIgnoreCase)) { return(trySchema); } var consistentSorts = trySchema.SortOrder .TakeWhile((sort, index) => index < catchSchema.SortOrder.Count && sort.Equals(catchSchema.SortOrder[index], StringComparison.OrdinalIgnoreCase)) .ToList(); return(new NodeSchema(trySchema) { SortOrder = consistentSorts }); }
protected override IEnumerable <Entity> ExecuteInternal(IDictionary <string, DataSource> dataSources, IQueryExecutionOptions options, IDictionary <string, Type> parameterTypes, IDictionary <string, object> parameterValues) { var useCatchSource = false; IEnumerator <Entity> enumerator; try { enumerator = TrySource.Execute(dataSources, options, parameterTypes, parameterValues).GetEnumerator(); } catch (Exception ex) { if (ExceptionFilter != null && !ExceptionFilter(ex)) { throw; } useCatchSource = true; enumerator = null; CaughtException = ex.Message; } var doneFirst = false; while (!useCatchSource && !options.Cancelled) { Entity current; try { if (!enumerator.MoveNext()) { break; } doneFirst = true; current = enumerator.Current; } catch (Exception ex) { if (doneFirst || ExceptionFilter != null && !ExceptionFilter(ex)) { throw; } useCatchSource = true; current = null; CaughtException = ex.Message; } if (!useCatchSource) { yield return(current); } } if (useCatchSource) { foreach (var entity in CatchSource.Execute(dataSources, options, parameterTypes, parameterValues)) { yield return(entity); } } }
public override int EstimateRowsOut(IDictionary <string, DataSource> dataSources, IQueryExecutionOptions options, IDictionary <string, Type> parameterTypes) { return(TrySource.EstimateRowsOut(dataSources, options, parameterTypes)); }
public override void AddRequiredColumns(IDictionary <string, DataSource> dataSources, IDictionary <string, Type> parameterTypes, IList <string> requiredColumns) { TrySource.AddRequiredColumns(dataSources, parameterTypes, requiredColumns); CatchSource.AddRequiredColumns(dataSources, parameterTypes, requiredColumns); }