public DslQueryModel Parse(List <DslToken> tokens) { LoadSequenceStack(tokens); PrepareLookaheads(); _queryModel = new DslQueryModel(); Match(); DiscardToken(TokenType.SequenceTerminator); return(_queryModel); }
public AdoQueryPayload GenerateQueryPayload(DslQueryModel dslQueryModel) { var adoQueryPayload = new AdoQueryPayload(); if (dslQueryModel.Limit.HasValue) { adoQueryPayload.AppendLine("SELECT TOP " + dslQueryModel.Limit.Value); } else { adoQueryPayload.AppendLine("SELECT"); } adoQueryPayload.AppendLine(@" ED.FingerprintText ,ED.ApplicationId ,ED.OriginExceptionType ,ED.OriginStackFrame ,ED.LowestAppStackFrame ,ED.HighestAppStackFrame ,SUM(T.Frequency) AS TotalErrors FROM Timeline T JOIN ErrorDefinition AS ED ON T.Fingerprint = ED.Fingerprint"); adoQueryPayload.Append("WHERE T.ErrorDateTime BETWEEN "); adoQueryPayload.AddFromDateParameter(dslQueryModel.DateRange.From); adoQueryPayload.Append(" AND "); adoQueryPayload.AddToDateParameter(dslQueryModel.DateRange.To); adoQueryPayload.AddNewLine(); for (int i = 0; i < dslQueryModel.MatchConditions.Count; i++) { if (i == 0) { AddLogicalOperator(adoQueryPayload, DslLogicalOperator.And); } else { AddLogicalOperator(adoQueryPayload, dslQueryModel.MatchConditions[i - 1].LogOpToNextCondition); } AddClause(dslQueryModel.MatchConditions[i], adoQueryPayload); } adoQueryPayload.AppendLine(@"GROUP BY ED.FingerprintText ,ED.ApplicationId ,ED.OriginExceptionType ,ED.OriginStackFrame ,ED.LowestAppStackFrame ,ED.HighestAppStackFrame ORDER BY TotalErrors DESC"); return(adoQueryPayload); }
public DslQueryModel Parse(List <DslToken> tokens) { matchCollections = new Stack <IList <MatchCondition> >(); conditions = new Stack <MatchCondition>(); LoadSequenceStack(tokens); PrepareLookaheads(); _queryModel = new DslQueryModel(); matchCollections.Push(_queryModel.MatchConditions); Match(); DiscardToken(TokenType.SequenceTerminator); return(_queryModel); }
public DslQueryModel Parse(List <DslToken> tokens) { // create the stack and load the lookaheads LoadSequenceStack(tokens); PrepareLookaheads(); _queryModel = new DslQueryModel(); // S -> CONDITION ComparisonCondition(); DiscardToken(TokenType.SequenceTerminator); return(_queryModel); }