//TODO: maybe move this to a subclass protected virtual RecordTable ApplyOutputClause(RecordTable source, OutputClause clause) { var selectors = Visit <Func <Environment, Func <IResultTable, Selector[]> > >(clause)?.Invoke(Database.GlobalEnvironment)(source); if (selectors != null) { return(new RecordTable(source.TableName, selectors, Filter.From(source.Records, (row) => true, null))); } return(null); }
protected override object InternalVisit(OutputClause node) { return(new Func <Environment, Func <IResultTable, Selector[]> >( (env) => { return new Func <IResultTable, Selector[]>((table) => { return node.SelectColumns.SelectMany( (element) => { return EvaluateExpression <Func <IResultTable, Selector[]> >(element, env)(table); }).ToArray(); }); })); }
public override void Visit(OutputClause node) { this.action(node); }
public override void ExplicitVisit(OutputClause fragment) { _fragments.Add(fragment); }