public DmlfConditionBase YearMonthCondition(string term) { var m = Regex.Match(term, @"(\d\d\d\d)\-(\d?\d)"); if (m.Success) { var cond = new DmlfAndCondition(); cond.Conditions.Add(new DmlfEqualCondition { LeftExpr = new DmlfFuncCallExpression("MONTH", _columnValue), RightExpr = new DmlfLiteralExpression { Value = Int32.Parse(m.Groups[2].Value) }, }); cond.Conditions.Add(new DmlfEqualCondition { LeftExpr = new DmlfFuncCallExpression("YEAR", _columnValue), RightExpr = new DmlfLiteralExpression { Value = Int32.Parse(m.Groups[1].Value) }, }); return(cond); } return(null); }
private DmlfAndCondition ParseFactor() { var res = new DmlfAndCondition(); while (!EndOfInput && !IsError && CurrentToken?.TokenType != FilterTokenType.COMMA) { res.Conditions.Add(ParseElement()); } return(res); }
private DmlfConditionBase DateTimeIntervalCondition(DateTime begin, DateTime end) { var and = new DmlfAndCondition(); and.Conditions.Add(new DmlfRelationCondition { LeftExpr = _columnValue, Relation = ">=", RightExpr = new DmlfLiteralExpression { Value = StringTool.DateTimeToIsoStringExact(begin) } }); and.Conditions.Add(new DmlfRelationCondition { LeftExpr = _columnValue, Relation = "<", RightExpr = new DmlfLiteralExpression { Value = StringTool.DateTimeToIsoStringExact(end) } }); return(and); }