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; }
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); }
public SelectListFieldInfo Parse(SelectAtomContext ctx) { var rslt = new SelectListFieldInfo(); rslt.SelectContext = new SelectContext(); Select.Parse(rslt.SelectContext); return rslt; }
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); }
public CaseElseExpressionInfo Parse(SelectAtomContext ctx) { var rslt = new CaseElseExpressionInfo(); rslt.Value = Result_expression_prior.Parse(ctx); return(rslt); }
public TableAllFieldInfo Parse(SelectAtomContext ctx) { return(new TableAllFieldInfo() { Table = this.Name }); }
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); }
public List<OrderInfo> Parse(SelectAtomContext ctx) { if (Order_clause == null) return null; return Order_clause.Parse(ctx); }
public FieldRegularInfo Parse(SelectAtomContext ctx) { return(new FieldRegularInfo() { FullName = this.Long_Name.Text }); }
public GroupInfo Parse(SelectAtomContext ctx) { if (Group_clause == null) return null; return Group_clause.Parse(ctx); }
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; }
public OrConditionInfo Parse(SelectAtomContext ctx) { var rslt = new OrConditionInfo(); Condition_clause.Parse(rslt); return(rslt); }
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); }
public ParameterFieldInfo Parse(SelectAtomContext ctx) { var para = new ParameterFieldInfo(); para.Name = Parameter_name.Text; return(para); }
public SelectListFieldInfo Parse(SelectAtomContext ctx) { var rslt = new SelectListFieldInfo(); rslt.SelectContext = new SelectContext(); Select.Parse(rslt.SelectContext); return(rslt); }
public ParameterFieldInfo Parse(SelectAtomContext ctx) { var para = new ParameterFieldInfo(); para.Name = Parameter_name.Text; return para; }
public BinaryConditionInfo Parse(SelectAtomContext ctx) { if (Binary == null) { return(null); } return(Binary.Parse(ctx)); }
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); }
public List <OrderInfo> Parse(SelectAtomContext ctx) { if (Order_clause == null) { return(null); } return(Order_clause.Parse(ctx)); }
public BinaryConditionInfo Parse(SelectAtomContext ctx) { if (Binary_compare_prior == null) { return(null); } return(Binary_compare_prior.Parse(ctx)); }
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; }
public SelectJoinInfo Parse(SelectAtomContext ctx) { var selectInfo = new SelectJoinInfo(); selectInfo.Alias = Alias; selectInfo.SubContext = new SelectContext(); Select.Parse(selectInfo.SubContext); return selectInfo; }
public GroupInfo Parse(SelectAtomContext ctx) { if (Group_clause == null) { return(null); } return(Group_clause.Parse(ctx)); }
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; }
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; }
public List<TableJoinInfo> Parse(SelectAtomContext ctx) { if (From_clause != null) { var temp = From_clause.Parse(ctx); return temp; } return null; }
public List <TableJoinInfo> Parse(SelectAtomContext ctx) { if (From_clause != null) { var temp = From_clause.Parse(ctx); return(temp); } return(null); }
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; }
public CaseHaveTargetWhenExpressionInfo Parse(SelectAtomContext ctx) { var rslt = new CaseHaveTargetWhenExpressionInfo(); rslt.Value = Value.Parse(ctx); rslt.ResultExpress = Result_expression_prior.Parse(ctx); return(rslt); }
public SelectJoinInfo Parse(SelectAtomContext ctx) { var selectInfo = new SelectJoinInfo(); selectInfo.Alias = Alias; selectInfo.SubContext = new SelectContext(); Select.Parse(selectInfo.SubContext); return(selectInfo); }
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); }
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); }
public BinaryExpressionFieldInfo Parse(SelectAtomContext ctx) { var rslt = new BinaryExpressionFieldInfo(); foreach (var expr in Multiplicative_expressions) { rslt.MultiplicativeExpressionInfos.Add(expr.Parse(ctx)); } return rslt; }
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; }
public BinaryExpressionFieldInfo Parse(SelectAtomContext ctx) { var rslt = new BinaryExpressionFieldInfo(); foreach (var expr in Multiplicative_expressions) { rslt.MultiplicativeExpressionInfos.Add(expr.Parse(ctx)); } return(rslt); }
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; }
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; }
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; }
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); }
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; }
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 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); }
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); }
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); }
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; }
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 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; }
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; }
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; }
//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; }
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; }
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; }
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; }