示例#1
0
        public override bool VisitExprDateAdd(ExprDateAdd exprDateAdd, IExpr?arg)
        {
            this.Builder.Append("DATEADD(");

            var datePart = exprDateAdd.DatePart switch
            {
                DateAddDatePart.Year => "yy",
                DateAddDatePart.Month => "m",
                DateAddDatePart.Day => "d",
                DateAddDatePart.Week => "wk",
                DateAddDatePart.Hour => "hh",
                DateAddDatePart.Minute => "mi",
                DateAddDatePart.Second => "s",
                DateAddDatePart.Millisecond => "ms",
                _ => throw new ArgumentOutOfRangeException()
            };

            this.Builder.Append(datePart);
            this.Builder.Append(',');
            this.Builder.Append(exprDateAdd.Number);
            this.Builder.Append(',');
            exprDateAdd.Date.Accept(this, exprDateAdd);
            this.Builder.Append(')');

            return(true);
        }
示例#2
0
        public bool VisitExprDateAdd(ExprDateAdd expr, TCtx arg)
        {
            var res = this.Visit(expr, "DateAdd", arg, out var argOut) && this.Accept("Date", expr.Date, argOut);

            this.VisitPlainProperty("DatePart", expr.DatePart, argOut);
            this.VisitPlainProperty("Number", expr.Number, argOut);
            this._visitor.EndVisitExpr(expr, arg);
            return(res);
        }
示例#3
0
 public static ExprDateAdd WithNumber(this ExprDateAdd original, Int32 newNumber)
 => new ExprDateAdd(date: original.Date, datePart: original.DatePart, number: newNumber);
示例#4
0
 public static ExprDateAdd WithDatePart(this ExprDateAdd original, DateAddDatePart newDatePart)
 => new ExprDateAdd(date: original.Date, datePart: newDatePart, number: original.Number);
示例#5
0
 public static ExprDateAdd WithDate(this ExprDateAdd original, ExprValue newDate)
 => new ExprDateAdd(date: newDate, datePart: original.DatePart, number: original.Number);
示例#6
0
 public abstract bool VisitExprDateAdd(ExprDateAdd exprDateAdd, IExpr?arg);
 public TRes VisitExprDateAdd(ExprDateAdd exprDateAdd, ExprValueTypeAnalyzerCtx <TRes, TCtx> ctx)
 {
     return(ctx.ValueVisitor.VisitDateTime(ctx.Ctx, null));
 }