Esempio n. 1
0
        public void Parse(SelectContext ctx)
        {
            //var result = new SelectContext();

            //if (ctx == null)
            //{
            //    result.ContextType = ContextType.Program;
            //}

            //SelectAtomContext.Context_Stack.Push(result);

            foreach (var atom in Select_atoms)
            {
                var a = new SelectAtomContext();
                ctx.Unions.Add(new UnionContext()
                {
                    Context = a
                });
                atom.Parse(a);
            }

            for (var index = 0; index < this.Union_types.Count; index++)
            {
                ctx.Unions[index].UnionType = Union_types[index].Parse();
            }

            //result.ParentContext = ctx;
            //SelectAtomContext.Context_Stack.Pop();

            //return result;
        }
Esempio n. 2
0
        public List <TableJoinInfo> Parse(SelectAtomContext ctx)
        {
            var rslt = new List <TableJoinInfo>();

            if (Table_alias_list != null)
            {
                foreach (var t in Table_alias_list)
                {
                    var joinTable = new TableJoinInfo();
                    t.Parse(joinTable);
                    joinTable.JoinType = JoinType.Outer;

                    rslt.Add(joinTable);
                }
                rslt[0].JoinType = JoinType.First;
                //return rslt;
            }
            if (Select_alias != null)
            {
                var selectCtx = Select_alias.Parse(ctx);
                //selectCtx.TableJoinInfos[0].JoinType = JoinType.First;
                //rslt.Add(selectCtx.TableJoinInfos[0]);
            }
            return(rslt);
        }
Esempio n. 3
0
 public SelectListFieldInfo Parse(SelectAtomContext ctx)
 {
     var rslt = new SelectListFieldInfo();
     rslt.SelectContext = new SelectContext();
     Select.Parse(rslt.SelectContext);
     return rslt;
 }
Esempio n. 4
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            if (Value != null)
            {
                return(Value.Parse(ctx));
            }

            if (All_field != null)
            {
                return(All_field.Parse(ctx));
            }

            if (Table_all_field != null)
            {
                return(Table_all_field.Parse(ctx));
            }

            if (Field_regular != null)
            {
                return(Field_regular.Parse(ctx));
            }

            if (Case_clause_field != null)
            {
                return(Case_clause_field.Parse(ctx));
            }

            if (Function_field != null)
            {
                return(Function_field.Parse(ctx));
            }

            return(null);
        }
Esempio n. 5
0
        public CaseElseExpressionInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseElseExpressionInfo();

            rslt.Value = Result_expression_prior.Parse(ctx);
            return(rslt);
        }
Esempio n. 6
0
 public TableAllFieldInfo Parse(SelectAtomContext ctx)
 {
     return(new TableAllFieldInfo()
     {
         Table = this.Name
     });
 }
Esempio n. 7
0
        public InCondtionInfo Parse(SelectAtomContext ctx)
        {
            var temp = Table_field.Parse(ctx);

            var condition = new InCondtionInfo();

            condition.LeftValue = temp;
            if (In_keyword.keyworkd == "in")
            {
                condition.ConditionType = ConditionType.In;
            }
            else if (In_keyword.keyworkd == "not in")
            {
                condition.ConditionType = ConditionType.NotIn;
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "没有这种in条件");
            }

            //if (temp != null)
            //{
            //    rslt.Condition.Conditions.Add(new ConditionComplexInfo());
            //    rslt.Condition.Conditions[0].Condition = condition;
            //}

            var listField = this.In_right_value.Parse(ctx);

            condition.RightValue = listField;
            return(condition);
        }
Esempio n. 8
0
        public List<OrderInfo> Parse(SelectAtomContext ctx)
        {
            if (Order_clause == null)
                return null;

            return Order_clause.Parse(ctx);
        }
Esempio n. 9
0
 public FieldRegularInfo Parse(SelectAtomContext ctx)
 {
     return(new FieldRegularInfo()
     {
         FullName = this.Long_Name.Text
     });
 }
Esempio n. 10
0
        public GroupInfo Parse(SelectAtomContext ctx)
        {
            if (Group_clause == null)
                return null;

            return Group_clause.Parse(ctx);
        }
Esempio n. 11
0
        public void Parse(SelectContext ctx)
        {
            //var result = new SelectContext();

            //if (ctx == null)
            //{
            //    result.ContextType = ContextType.Program;
            //}

            //SelectAtomContext.Context_Stack.Push(result);

            foreach (var atom in Select_atoms)
            {
                var a = new SelectAtomContext();
                ctx.Unions.Add(new UnionContext() { Context = a });
                atom.Parse(a);
            }

            for (var index = 0; index < this.Union_types.Count; index++)
            {
                ctx.Unions[index].UnionType = Union_types[index].Parse();
            }

            //result.ParentContext = ctx;
            //SelectAtomContext.Context_Stack.Pop();

            //return result;
        }
Esempio n. 12
0
        public InCondtionInfo Parse(SelectAtomContext ctx)
        {
            var temp = Table_field.Parse(ctx);

            var condition = new InCondtionInfo();
            condition.LeftValue = temp;
            if (In_keyword.keyworkd == "in")
            {
                condition.ConditionType = ConditionType.In;
            }
            else if (In_keyword.keyworkd == "not in")
            {
                condition.ConditionType = ConditionType.NotIn;
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "û������in����");
            }

            //if (temp != null)
            //{
            //    rslt.Condition.Conditions.Add(new ConditionComplexInfo());
            //    rslt.Condition.Conditions[0].Condition = condition;
            //}

            var listField = this.In_right_value.Parse(ctx);
            condition.RightValue = listField;
            return condition;
        }
Esempio n. 13
0
        public OrConditionInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new OrConditionInfo();

            Condition_clause.Parse(rslt);
            return(rslt);
        }
Esempio n. 14
0
        public GroupInfo Parse(SelectAtomContext ctx)
        {
            var result = new GroupInfo();

            foreach (var f in this.Field_regulars)
            {
                var temp            = f.Parse(ctx);
                FieldRegularInfo fr = temp;
                if (fr == null)
                {
                    System.Diagnostics.Debug.Assert(false, "分组字段名有问题");
                }

                result.Fields.Add(fr.FullName);
            }

            if (Having_clause_full != null)
            {
                result.Having = new HavingInfo();
                Having_clause_full.Parse(result.Having);
                //result.Having = temp;
                //result = result.Join(temp);
            }
            return(result);
        }
Esempio n. 15
0
        public ParameterFieldInfo Parse(SelectAtomContext ctx)
        {
            var para = new ParameterFieldInfo();

            para.Name = Parameter_name.Text;

            return(para);
        }
Esempio n. 16
0
        public SelectListFieldInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new SelectListFieldInfo();

            rslt.SelectContext = new SelectContext();
            Select.Parse(rslt.SelectContext);
            return(rslt);
        }
Esempio n. 17
0
        public ParameterFieldInfo Parse(SelectAtomContext ctx)
        {
            var para = new ParameterFieldInfo();

            para.Name = Parameter_name.Text;

            return para;
        }
Esempio n. 18
0
        public BinaryConditionInfo Parse(SelectAtomContext ctx)
        {
            if (Binary == null)
            {
                return(null);
            }

            return(Binary.Parse(ctx));
        }
Esempio n. 19
0
        public BinaryConditionInfo Parse(SelectAtomContext ctx)
        {
            BinaryConditionInfo rslt = null;

            if (Binary_compare != null)
            {
                rslt = Binary_compare.Parse(ctx);
            }

            //SqlContext.Condition_Stack.Peek().Conditions.Add(
            //    new ConditionComplexInfo {  Condition = rslt});

            //var condition = rslt.Condition.Conditions[0].Condition;

            if (Condition_option != null)
            {
                if (string.Compare(Condition_option.Option, "?", true) == 0)
                {
                    rslt.Required = false;
                }
                else if (string.Compare(Condition_option.Option, "#", true) == 0)
                {
                    rslt.Required = true;
                }

                //if ( rslt.LeftValue.IsParameter )
                //{
                //    rslt.
                //}
                //foreach (var p in rslt.LeftValue.IsParameter)
                //{
                //    p.NullAble = !condition.Required;
                //}
            }
            if (this.Search_option != null)
            {
                if (Search_option == null || Search_option.Option_expression == null ||
                    Search_option.Option_expression.Option_list == null ||
                    Search_option.Option_expression.Option_list.Options == null)
                {
                    return(rslt);
                }

                foreach (var option in Search_option.Option_expression.Option_list.Options)
                {
                    rslt.Options.Add(
                        new SqlOption()
                    {
                        Name = option.Option_name.Text.Replace("'", ""), Value = option.Option_value.text.Replace("'", "")
                    });
                }
            }



            return(rslt);
        }
Esempio n. 20
0
        public List <OrderInfo> Parse(SelectAtomContext ctx)
        {
            if (Order_clause == null)
            {
                return(null);
            }

            return(Order_clause.Parse(ctx));
        }
Esempio n. 21
0
        public BinaryConditionInfo Parse(SelectAtomContext ctx)
        {
            if (Binary_compare_prior == null)
            {
                return(null);
            }

            return(Binary_compare_prior.Parse(ctx));
        }
Esempio n. 22
0
        public CaseWhenExprressInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseWhenExprressInfo();
            rslt.Condition = condition_clause_prior.Parse(ctx);

            rslt.ResultExpress = result_expression_prior.Parse(ctx);

            return rslt;
        }
        public CaseHaveTargetWhenExpressionInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseHaveTargetWhenExpressionInfo();
            rslt.Value = Value.Parse(ctx);

            rslt.ResultExpress = Result_expression_prior.Parse(ctx);

            return rslt;
        }
Esempio n. 24
0
        public SelectJoinInfo Parse(SelectAtomContext ctx)
        {
            var selectInfo = new SelectJoinInfo();
            selectInfo.Alias = Alias;
            selectInfo.SubContext = new SelectContext();

            Select.Parse(selectInfo.SubContext);
            return selectInfo;
        }
Esempio n. 25
0
        public GroupInfo Parse(SelectAtomContext ctx)
        {
            if (Group_clause == null)
            {
                return(null);
            }

            return(Group_clause.Parse(ctx));
        }
Esempio n. 26
0
        public void Parse(SelectAtomContext ctx)
        {
            //SelectAtomContext result = new SelectAtomContext();

            //SelectAtomContext.Context_Stack.Push(result);

            if (this.Select != null)
            {
                ctx.SelectContext = new SelectContext();
                Select.Parse(ctx.SelectContext);
                return;
            }

            if (Select_clause_full != null)
            {
                var temp = Select_clause_full.Parse(ctx);
                ctx.ReturnFields.AddRange(temp);
            }

            if (From_clause_full != null)
            {
                var temp = From_clause_full.Parse(ctx);
                ctx.TableJoinInfos.AddRange(temp);
            }

            if (Join_clause_full != null)
            {
                var temp = Join_clause_full.Parse(ctx);
                ctx.TableJoinInfos.AddRange(temp);
            }

            if (Conditon_clause_full != null)
            {
                ctx.Condition = new OrConditionInfo();
                Conditon_clause_full.Parse(ctx.Condition);
                //ctx.Condition = temp;
            }

            if (Group_clause_full != null)
            {
                var temp = Group_clause_full.Parse(ctx);
                ctx.Group = temp;
            }

            if (Order_clause_full != null)
            {
                var temp = Order_clause_full.Parse(ctx);
                ctx.OrderInfos.AddRange(temp);
            }

            //result.ParentContext = ctx;

            //SelectAtomContext.Context_Stack.Pop();

            //return result;
        }
Esempio n. 27
0
        public void Parse(SelectAtomContext ctx)
        {
            //SelectAtomContext result = new SelectAtomContext();

            //SelectAtomContext.Context_Stack.Push(result);

            if (this.Select != null)
            {
                ctx.SelectContext = new SelectContext();
                Select.Parse(ctx.SelectContext);
                return;
            }

            if (Select_clause_full != null)
            {
                var temp = Select_clause_full.Parse(ctx);
                ctx.ReturnFields.AddRange(temp);
            }

            if (From_clause_full != null)
            {
                var temp = From_clause_full.Parse(ctx);
                ctx.TableJoinInfos.AddRange(temp);
            }

            if (Join_clause_full != null)
            {
                var temp = Join_clause_full.Parse(ctx);
                ctx.TableJoinInfos.AddRange(temp);
            }

            if (Conditon_clause_full != null)
            {
                ctx.Condition = new OrConditionInfo();
                Conditon_clause_full.Parse(ctx.Condition);
                //ctx.Condition = temp;
            }

            if (Group_clause_full != null)
            {
                var temp = Group_clause_full.Parse(ctx);
                ctx.Group = temp;
            }

            if (Order_clause_full != null)
            {
                var temp = Order_clause_full.Parse(ctx);
                ctx.OrderInfos.AddRange(temp);
            }

            //result.ParentContext = ctx;

            //SelectAtomContext.Context_Stack.Pop();

            //return result;
        }
Esempio n. 28
0
        public List<FieldInfo> Parse(SelectAtomContext ctx)
        {
            if (Top_clause != null)
                ctx.TopValue = Top_clause.Parse();

            if (Select_clause != null)
                return Select_clause.Parse(ctx);

            return null;
        }
Esempio n. 29
0
        public List<TableJoinInfo> Parse(SelectAtomContext ctx)
        {
            if (From_clause != null)
            {
                var temp = From_clause.Parse(ctx);
                return temp;
            }

            return null;
        }
Esempio n. 30
0
        public List <TableJoinInfo> Parse(SelectAtomContext ctx)
        {
            if (From_clause != null)
            {
                var temp = From_clause.Parse(ctx);
                return(temp);
            }

            return(null);
        }
Esempio n. 31
0
        public UnaryOperatorInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new UnaryOperatorInfo();
            if (Operator.Equals("~"))
                rslt.IsNegate = true;
            if ( Table_field_atom != null )
                rslt.FieldInfo = Table_field_atom.Parse(ctx);

            return rslt;
        }
Esempio n. 32
0
        public CaseHaveTargetWhenExpressionInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseHaveTargetWhenExpressionInfo();

            rslt.Value = Value.Parse(ctx);

            rslt.ResultExpress = Result_expression_prior.Parse(ctx);

            return(rslt);
        }
Esempio n. 33
0
        public SelectJoinInfo Parse(SelectAtomContext ctx)
        {
            var selectInfo = new SelectJoinInfo();

            selectInfo.Alias      = Alias;
            selectInfo.SubContext = new SelectContext();

            Select.Parse(selectInfo.SubContext);
            return(selectInfo);
        }
Esempio n. 34
0
        public CaseWhenExprressInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseWhenExprressInfo();

            rslt.Condition = condition_clause_prior.Parse(ctx);

            rslt.ResultExpress = result_expression_prior.Parse(ctx);

            return(rslt);
        }
        public List <FieldInfo> Parse(SelectAtomContext ctx)
        {
            var rslt = new List <FieldInfo>();

            foreach (var p in this.Function_parameters)
            {
                rslt.Add(p.Parse(ctx));
                //rslt = rslt.Join(temp);
            }
            return(rslt);
        }
Esempio n. 36
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            var dbType = DbType.Unknown;

            if (Is_bool)
            {
                dbType = DbType.Bool;
            }
            if (Is_int)
            {
                dbType = DbType.Int;
            }
            if (Is_float)
            {
                dbType = DbType.Float;
            }
            if (Is_char)
            {
                dbType = DbType.Char;
            }
            if (Is_string)
            {
                dbType = DbType.String;
            }
            if (Is_parameter)
            {
                dbType = DbType.Parameter;
            }
            if (Is_option_string)
            {
                dbType = DbType.OptionString;
            }

            var v = new ValueFieldInfo()
            {
                DbType = dbType, Value = this.value
            };

            if (Is_parameter)
            {
                v.FullName = v.Value = this.Parameter.Parameter_name.Text;
                return(new ParameterFieldInfo()
                {
                    Name = v.FullName
                });
            }

            if (Is_select_list)
            {
                var list = this.select_list.Parse(ctx);
                return(list);
            }
            return(v);
        }
Esempio n. 37
0
        public BinaryExpressionFieldInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new BinaryExpressionFieldInfo();

            foreach (var expr in Multiplicative_expressions)
            {
                rslt.MultiplicativeExpressionInfos.Add(expr.Parse(ctx));
            }

            return rslt;
        }
Esempio n. 38
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            if (Table_field_atom != null)
                return Table_field_atom.Parse(ctx);

            if (Binary_expression != null)
            {
                return Binary_expression.Parse(ctx);
            }
            return null;
        }
        public List<FieldInfo> Parse(SelectAtomContext ctx)
        {
            var rslt = new List<FieldInfo>();

            foreach (var p in this.Function_parameters)
            {
                rslt.Add( p.Parse(ctx));
                //rslt = rslt.Join(temp);
            }
            return rslt;
        }
Esempio n. 40
0
        public BinaryExpressionFieldInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new BinaryExpressionFieldInfo();

            foreach (var expr in Multiplicative_expressions)
            {
                rslt.MultiplicativeExpressionInfos.Add(expr.Parse(ctx));
            }

            return(rslt);
        }
Esempio n. 41
0
        public BinaryConditionInfo Parse(SelectAtomContext ctx)
        {
            BinaryConditionInfo rslt = null ;

            if (Binary_compare != null)
            {
                rslt = Binary_compare.Parse(ctx);
            }

            //SqlContext.Condition_Stack.Peek().Conditions.Add(
            //    new ConditionComplexInfo {  Condition = rslt});

            //var condition = rslt.Condition.Conditions[0].Condition;

            if (Condition_option != null)
            {

                if (string.Compare(Condition_option.Option, "?", true) == 0)
                {
                    rslt.Required = false;
                }
                else if (string.Compare(Condition_option.Option, "#", true) == 0)
                {
                    rslt.Required = true;
                }

                //if ( rslt.LeftValue.IsParameter )
                //{
                //    rslt.
                //}
                //foreach (var p in rslt.LeftValue.IsParameter)
                //{
                //    p.NullAble = !condition.Required;
                //}

            }
            if (this.Search_option != null)
            {
                if (Search_option == null || Search_option.Option_expression == null ||
                Search_option.Option_expression.Option_list == null ||
                Search_option.Option_expression.Option_list.Options == null)
                    return rslt;

                foreach (var option in Search_option.Option_expression.Option_list.Options)
                {
                    rslt.Options.Add(
                        new SqlOption() { Name = option.Option_name.Text.Replace("'", ""), Value = option.Option_value.text.Replace("'", "") });
                }

            }

            return rslt;
        }
Esempio n. 42
0
        public CaseFieldNoTargetInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseFieldNoTargetInfo();
            foreach (var expr in Case_when_expressions)
            {
                rslt.CaseWhenExprresses.Add(expr.Parse(ctx));
            }

            rslt.CaseElseExpression = Case_else_expression.Parse(ctx);

            return rslt;
        }
Esempio n. 43
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new ListFieldInfo();

            if (Parameter != null)
                return Parameter.Parse(ctx);

            if (List != null)
                return List.Parse(ctx);

            return rslt;
        }
Esempio n. 44
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            if (Value_list != null)
            {
                return(Value_list.Parse(ctx));
            }
            if (Select_list != null)
            {
                return(Select_list.Parse(ctx));
            }

            return(null);
        }
Esempio n. 45
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            if (Value_list != null)
            {
                return Value_list.Parse(ctx);
            }
            if (Select_list != null)
            {
                return Select_list.Parse(ctx);
            }

            return null;
        }
Esempio n. 46
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            if (Table_field_atom != null)
            {
                return(Table_field_atom.Parse(ctx));
            }

            if (Binary_expression != null)
            {
                return(Binary_expression.Parse(ctx));
            }
            return(null);
        }
Esempio n. 47
0
        public CaseFieldNoTargetInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseFieldNoTargetInfo();

            foreach (var expr in Case_when_expressions)
            {
                rslt.CaseWhenExprresses.Add(expr.Parse(ctx));
            }

            rslt.CaseElseExpression = Case_else_expression.Parse(ctx);

            return(rslt);
        }
Esempio n. 48
0
        public List <FieldInfo> Parse(SelectAtomContext ctx)
        {
            if (Top_clause != null)
            {
                ctx.TopValue = Top_clause.Parse();
            }

            if (Select_clause != null)
            {
                return(Select_clause.Parse(ctx));
            }

            return(null);
        }
Esempio n. 49
0
        public CaseFieldInfo Parse(SelectAtomContext ctx)
        {
            if (Case_have_target_expression != null)
            {
                return(Case_have_target_expression.Parse(ctx));
            }

            if (Case_expression != null)
            {
                return(Case_expression.Parse(ctx));
            }

            return(null);
        }
Esempio n. 50
0
        public FunctionFieldInfo Parse(SelectAtomContext ctx)
        {
            var f = new FunctionFieldInfo();

            f.FunctionName = this.Name;

            if (Function_parameter_list != null)
            {
                var temp = this.Function_parameter_list.Parse(ctx);

                f.ParameterFields.AddRange(temp);
            }
            return(f);
        }
        public MultiplicativeExpressionInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new MultiplicativeExpressionInfo();

            foreach (var op in Operators)
            {
                rslt.Operators.Add(op);
            }

            foreach (var expression in this.Positive_expressions)
            {
                rslt.PositiveExpressionInfos.Add(expression.Parse(ctx));
            }
            return rslt;
        }
Esempio n. 52
0
        public FunctionFieldInfo Parse(SelectAtomContext ctx)
        {
            var f = new FunctionFieldInfo();

            f.FunctionName = this.Name;

            if (Function_parameter_list != null)
            {
                var temp = this.Function_parameter_list.Parse(ctx);

                f.ParameterFields.AddRange(temp);

            }
            return f;
        }
Esempio n. 53
0
        public PositiveExpressionInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new PositiveExpressionInfo();
            rslt.IsPositive = true;
            if (!string.IsNullOrWhiteSpace(Operator))
            {
                if (Operator == "-")
                    rslt.IsPositive = false;
            }

            if (Unary_operator != null)
                rslt.UnaryOperatorInfo = Unary_operator.Parse(ctx);

            return rslt;
        }
Esempio n. 54
0
        public List<OrderInfo> Parse(SelectAtomContext ctx)
        {
            if (Order_expressions == null || Order_expressions.Count == 0)
                return null;

            var rslt = new List<OrderInfo>();

            foreach (var order in Order_expressions)
            {
                var temp = order.Parse(ctx);
                rslt.Add(temp);
            }

            return rslt;
        }
Esempio n. 55
0
        public ConditionInfo Parse(SelectAtomContext ctx)
        {
            if (Bianary_prior != null)
                return Bianary_prior.Parse(ctx);

            if (In_expression_prior != null)
                return In_expression_prior.Parse(ctx);

            if (Between_prior != null)
                return Between_prior.Parse(ctx);

            if (Existed_compare_prior != null)
                return Existed_compare_prior.Parse(ctx);

            return null;
        }
Esempio n. 56
0
        //public Select Select { get; set; }
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new FieldInfo();
            if (Value != null)
                return Value.Parse(ctx);

            //if (Select != null)
            //{
            //    var subCtx = new SelectContext();

            //    Select.Parse(subCtx);

            //    rslt.Select = subCtx;

            //}
            return rslt;
        }
        public CaseFieldWithTargetInfo Parse(SelectAtomContext ctx)
        {
            var rslt = new CaseFieldWithTargetInfo();
            rslt.Target = Table_field.Parse(ctx);

            foreach (var expr in this.Case_have_target_when_expressions)
            {
                rslt.CaseHaveTargetWhenExpressions.Add(expr.Parse(ctx));
            }

            if (Case_else_expression != null)
            {
                rslt.CaseElseExpression = Case_else_expression.Parse(ctx);
            }

            return rslt;
        }
Esempio n. 58
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            if (Values == null || Values.Count == 0)
            {
                return null;
            }

            var f = new ValueListFieldInfo();

            foreach (var v in Values)
            {
                var temp = v.Parse(ctx);
                f.Fields.Add(temp);
            }

            return f;
        }
Esempio n. 59
0
        public FieldInfo Parse(SelectAtomContext ctx)
        {
            var dbType = DbType.Unknown;
            if ( Is_bool ){
                dbType = DbType.Bool;
            }
            if (Is_int)
            {
                dbType = DbType.Int;
            }
            if (Is_float)
            {
                dbType = DbType.Float;
            }
            if (Is_char)
            {
                dbType = DbType.Char;
            }
            if (Is_string)
            {
                dbType = DbType.String;
            }
            if (Is_parameter)
            {
                dbType = DbType.Parameter;
            }
            if (Is_option_string)
            {
                dbType = DbType.OptionString;
            }

            var v = new ValueFieldInfo() { DbType = dbType, Value = this.value };

            if (Is_parameter)
            {
                v.FullName = v.Value = this.Parameter.Parameter_name.Text;
                return new ParameterFieldInfo() { Name = v.FullName };
            }

            if (Is_select_list)
            {
                var list = this.select_list.Parse(ctx);
                return list;
            }
            return v;
        }
Esempio n. 60
0
        public OrderInfo Parse(SelectAtomContext ctx)
        {
            if (Field_regular == null)
                return null;

            OrderInfo rslt = null;
            var temp = Field_regular.Parse(ctx);
            if (temp != null)
            {
                var order = new OrderInfo();

                var fr = temp;
                order.Field = fr.FullName;
                order.OrderType = Is_desc ? OrderType.Desc : OrderType.Asc;
                return order;

            }
            return rslt;
        }