Exemple #1
0
        public override void SetArgument(int index, Net.Vpc.Upa.Expressions.Expression e)
        {
            switch (index)
            {
            case 0:
            {
                type = (Net.Vpc.Upa.Expressions.DatePartType)((Net.Vpc.Upa.Expressions.Cst)e).GetValue();
                break;
            }

            case 1:
            {
                @value = e;
                break;
            }
            }
            throw new System.IndexOutOfRangeException();
        }
Exemple #2
0
 private void Init(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Expressions.Expression val)
 {
     this.type   = type;
     this.@value = val;
 }
Exemple #3
0
 public DatePart(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Expressions.Expression val)
 {
     Init(type, val);
 }
Exemple #4
0
 public DatePart(Net.Vpc.Upa.Expressions.DatePartType type, string varDate)  : this(type, new Net.Vpc.Upa.Expressions.UserExpression(varDate))
 {
 }
Exemple #5
0
 public DatePart(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Types.Temporal date)  : this(type, new Net.Vpc.Upa.Expressions.Literal(date))
 {
 }
 public CompiledDateDiff(Net.Vpc.Upa.Expressions.DatePartType datePartType, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression startDate, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression endDate)  : base("DateDiff")
 {
     ProtectedAddArgument(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledCst(datePartType));
     ProtectedAddArgument(startDate);
     ProtectedAddArgument(endDate);
 }
 public CompiledDateAdd(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression count, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression date)  : base("DateAdd")
 {
     ProtectedAddArgument(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledCst(type));
     ProtectedAddArgument(count);
     ProtectedAddArgument(date);
 }
Exemple #8
0
 public DateDiff(Net.Vpc.Upa.Expressions.DatePartType datePartType, Net.Vpc.Upa.Expressions.Expression startDate, Net.Vpc.Upa.Expressions.Expression endDate)
 {
     Init(datePartType, startDate, endDate);
 }
Exemple #9
0
 public CompiledDateTrunc(Net.Vpc.Upa.Expressions.DatePartType type, string varDate)  : this(type, new Net.Vpc.Upa.Impl.Uql.Compiledexpression.UserCompiledExpression(varDate, Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform.DATETIME))
 {
 }
Exemple #10
0
 public CompiledDateTrunc(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Types.Temporal date)  : this(type, new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(date))
 {
 }
Exemple #11
0
        public virtual object Eval(Net.Vpc.Upa.EvalContext evalContext)
        {
            object[] arg = evalContext.GetArguments();
            Net.Vpc.Upa.Expressions.DatePartType type = (Net.Vpc.Upa.Expressions.DatePartType)arg[0];
            object count = (object)arg[1];

            Net.Vpc.Upa.Types.Date     date     = (Net.Vpc.Upa.Types.Date)arg[2];
            Net.Vpc.Upa.Types.Calendar instance = Net.Vpc.Upa.Types.Calendar.GetInstance();
            instance.SetTime(date);
            int f = -1;

            switch (type)
            {
            case Net.Vpc.Upa.Expressions.DatePartType.DATE:
            {
                f = Net.Vpc.Upa.Types.Calendar.DATE;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAY:
            {
                f = Net.Vpc.Upa.Types.Calendar.DATE;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFMONTH:
            {
                f = Net.Vpc.Upa.Types.Calendar.DAY_OF_MONTH;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFWEEK:
            {
                f = Net.Vpc.Upa.Types.Calendar.DAY_OF_WEEK;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFYEAR:
            {
                f = Net.Vpc.Upa.Types.Calendar.DAY_OF_YEAR;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.HOUR:
            {
                f = Net.Vpc.Upa.Types.Calendar.HOUR;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.MILLISECOND:
            {
                f = Net.Vpc.Upa.Types.Calendar.MILLISECOND;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.MINUTE:
            {
                f = Net.Vpc.Upa.Types.Calendar.MINUTE;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.SECOND:
            {
                f = Net.Vpc.Upa.Types.Calendar.SECOND;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.MONTH:
            {
                f = Net.Vpc.Upa.Types.Calendar.MONTH;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.WEEK:
            {
                f = Net.Vpc.Upa.Types.Calendar.WEEK_OF_MONTH;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.YEAR:
            {
                f = Net.Vpc.Upa.Types.Calendar.YEAR;
                break;
            }

            default:
            {
                throw new System.Exception("Unsupported");
            }
            }
            instance.Add(f, System.Convert.ToInt32(count));
            return(instance.GetTime());
        }
        public virtual object Eval(Net.Vpc.Upa.EvalContext evalContext)
        {
            object[] arg = evalContext.GetArguments();
            Net.Vpc.Upa.Expressions.DatePartType type = (Net.Vpc.Upa.Expressions.DatePartType)arg[0];
            object count = (object)arg[1];

            Net.Vpc.Upa.Types.Date     date     = (Net.Vpc.Upa.Types.Date)arg[2];
            Net.Vpc.Upa.Types.Calendar instance = Net.Vpc.Upa.Types.Calendar.GetInstance();
            instance.SetTime(date);
            int f = -1;

            switch (type)
            {
            case Net.Vpc.Upa.Expressions.DatePartType.DATE:
            {
                f = Net.Vpc.Upa.Types.Calendar.DATE;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAY:
            {
                f = Net.Vpc.Upa.Types.Calendar.DATE;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFMONTH:
            {
                f = Net.Vpc.Upa.Types.Calendar.DAY_OF_MONTH;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFWEEK:
            {
                f = Net.Vpc.Upa.Types.Calendar.DAY_OF_WEEK;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFYEAR:
            {
                f = Net.Vpc.Upa.Types.Calendar.DAY_OF_YEAR;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.HOUR:
            {
                f = Net.Vpc.Upa.Types.Calendar.HOUR;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.MILLISECOND:
            {
                f = Net.Vpc.Upa.Types.Calendar.MILLISECOND;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.MINUTE:
            {
                f = Net.Vpc.Upa.Types.Calendar.MINUTE;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.SECOND:
            {
                f = Net.Vpc.Upa.Types.Calendar.SECOND;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.MONTH:
            {
                f = Net.Vpc.Upa.Types.Calendar.MONTH;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.WEEK:
            {
                f = Net.Vpc.Upa.Types.Calendar.WEEK_OF_MONTH;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.YEAR:
            {
                f = Net.Vpc.Upa.Types.Calendar.YEAR;
                break;
            }

            case Net.Vpc.Upa.Expressions.DatePartType.DAYOFWEEKNAME:
            {
                switch (instance.Get(Net.Vpc.Upa.Types.Calendar.DAY_OF_WEEK))
                {
                case 1:
                {
                    return("Sunday");
                }

                case 2:
                {
                    return("Monday");
                }

                case 3:
                {
                    return("Tuesday");
                }

                case 4:
                {
                    return("Wednesday");
                }

                case 5:
                {
                    return("Thursday");
                }

                case 6:
                {
                    return("Friday");
                }

                case 7:
                {
                    return("Saturday");
                }

                default:
                {
                    return("");
                }
                }
            }
            break;

            case Net.Vpc.Upa.Expressions.DatePartType.MONTHNAME:
            {
                switch (instance.Get(Net.Vpc.Upa.Types.Calendar.MONTH))
                {
                case 1:
                {
                    return("January");
                }

                case 2:
                {
                    return("February");
                }

                case 3:
                {
                    return("March");
                }

                case 4:
                {
                    return("April");
                }

                case 5:
                {
                    return("May");
                }

                case 6:
                {
                    return("June");
                }

                case 7:
                {
                    return("July");
                }

                case 8:
                {
                    return("August");
                }

                case 9:
                {
                    return("September");
                }

                case 10:
                {
                    return("October");
                }

                case 11:
                {
                    return("November");
                }

                case 12:
                {
                    return("December");
                }

                default:
                {
                    return("");
                }
                }
            }
            break;

            default:
            {
                throw new System.Exception("Unsupported");
            }
            }
            return(instance.Get(f));
        }
Exemple #13
0
 private void Init(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Expressions.Expression count, Net.Vpc.Upa.Expressions.Expression date)
 {
     this.type  = type;
     this.count = count;
     this.date  = date;
 }
Exemple #14
0
 public DateAdd(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Expressions.Expression count, Net.Vpc.Upa.Expressions.Expression date)
 {
     Init(type, count, date);
 }
Exemple #15
0
 public CompiledDateTrunc(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression val)  : base("Datetrunc")
 {
     ProtectedAddArgument(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledCst(type));
     ProtectedAddArgument(val);
 }
Exemple #16
0
 public DateDiff(Net.Vpc.Upa.Expressions.DatePartType datePartType, Net.Vpc.Upa.Types.Temporal date1, Net.Vpc.Upa.Types.Temporal date2)  : this(datePartType, new Net.Vpc.Upa.Expressions.Literal(date1), new Net.Vpc.Upa.Expressions.Literal(date2))
 {
 }
 public CompiledDateDiff(Net.Vpc.Upa.Expressions.DatePartType datePartType, Net.Vpc.Upa.Types.Temporal date1, Net.Vpc.Upa.Types.Temporal date2)  : this(datePartType, new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(date1), new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(date2))
 {
 }
Exemple #18
0
 private void Init(Net.Vpc.Upa.Expressions.DatePartType datePartType, Net.Vpc.Upa.Expressions.Expression startDate, Net.Vpc.Upa.Expressions.Expression endDate)
 {
     this.type  = datePartType;
     this.start = startDate;
     this.end   = endDate;
 }
 public CompiledDatePart(Net.Vpc.Upa.Expressions.DatePartType type, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression @value)  : base("Datepart")
 {
     ProtectedAddArgument(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledCst(type));
     ProtectedAddArgument(@value);
 }