public IExecutableCommand ProcessLine(LogParsingContext context) { CommandConnector connector = new CommandConnector(); connector.Add(new ValidateInputLogLineColumnsCommand(context)); connector.Add(new LoadGeneralInfoToContextCommand(context)); connector.Add(new ApplyWorkloadDefinitionCommand(context)); connector.Add(new ActionDelegateCommand(() => { var command = logParsingDetailCommandFactory.GetDetailCommand(context); if (command != null) { try { command.Execute(); } catch (Exception) { //todo } return(true); } return(false); })); connector.Add(new AddLogEntryToContextCommand(context)); return(connector.FirstCommand); }
public IChainableCommand GetDetailCommand(LogParsingContext context) { Regex queryRegex = new Regex(@"{QUERY[\s|\S]*}"); Regex planRegex = new Regex(@"{PLANNEDSTMT[\s|\S]*}"); string input = context.InputColumns[10]; Match match = null; if (input.StartsWith("STATEMENT:")) { return(new LoadStatementToContextCommand(context, input.Substring(10))); } else if ((match = queryRegex.Match(input)) != null && match.Success) { return(new LoadDebugTreeToContextCommand(() => match.Value, x => context.LogEntry.QueryTree = x)); } else if ((match = planRegex.Match(input)) != null && match.Success) { return(new LoadDebugTreeToContextCommand(() => match.Value, x => context.LogEntry.PlanTree = x)); } // todo statement // todo duration return(null); }
public AddLogEntryToContextCommand(LogParsingContext context) { this.context = context; }
public LoadStatementToContextCommand(LogParsingContext context, string statement) { this.context = context; this.statement = statement; }
public ApplyWorkloadDefinitionCommand(LogParsingContext context) { this.context = context; }
public LoadGeneralInfoToContextCommand(LogParsingContext context) { this.context = context; }
public ValidateInputLogLineColumnsCommand(LogParsingContext context) { this.context = context; }