Beispiel #1
0
        public SqlSection AddTokenSection(bool isReservedWord, params Token[] tokens)
        {
            var section = new SqlSection(this, new SqlToken(isReservedWord, tokens));

            Sections.Add(section);
            return(section);
        }
Beispiel #2
0
        private SqlSection AddParenthesisGroup(Token[] tokens, ref int i, SqlSection parent)
        {
            var section = new SqlSection(parent);

            section.Sections.Add(new SqlSection(section, new SqlToken(false, tokens[i])));
            parent.Sections.Add(section);

            for (i++; i < tokens.Length; i++)
            {
                if (tokens[i].Type == TokenType.StartParenthesis)
                {
                    if (IsMatch(tokens, i + 1, "SELECT"))
                    {
                        var query = new SqlQuery(section);
                        AddTokenSection(query, tokens[i]);
                        i++;
                        AddSelect(tokens, ref i, query);
                        section.Sections.Add(query);
                    }
                    else
                    {
                        AddParenthesisGroup(tokens, ref i, section);
                        continue;
                    }
                }
                else if (tokens[i].Type == TokenType.EndParenthesis)
                {
                    AddTokenSection(section, tokens[i]);
                    break;
                }
                else if (tokens[i].Type == TokenType.EndOfQuery)
                {
                    AddTokenSection(parent, tokens[i]);
                    break;
                }
                else if (IsQueryStart(tokens[i]))
                {
                    i--;
                    break;
                }

                AddTokenSection(section, tokens[i]);
            }
            return(section);
        }
Beispiel #3
0
 private void AddTokenSection(SqlSection parent, Token t)
 {
     parent.AddTokenSection(IsReservedWord(t), t);
 }
Beispiel #4
0
 public SqlGroupBy(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #5
0
        private SqlSection AddParenthesisGroup(Token[] tokens, ref int i, SqlSection parent)
        {
            var section = new SqlSection(parent);
            section.Sections.Add(new SqlSection(section, new SqlToken(false, tokens[i])));
            parent.Sections.Add(section);

            for (i++; i < tokens.Length; i++)
            {
                if (tokens[i].Type == TokenType.StartParenthesis)
                {
                    if (IsMatch(tokens, i + 1, "SELECT"))
                    {
                        var query = new SqlQuery(section);
                        AddTokenSection(query, tokens[i]);
                        i++;
                        AddSelect(tokens, ref i, query);
                        section.Sections.Add(query);
                    }
                    else
                    {
                        AddParenthesisGroup(tokens, ref i, section);
                        continue;
                    }
                }
                else if (tokens[i].Type == TokenType.EndParenthesis)
                {
                    AddTokenSection(section, tokens[i]);
                    break;
                }
                else if (tokens[i].Type == TokenType.EndOfQuery)
                {
                    AddTokenSection(parent, tokens[i]);
                    break;
                }
                else if (IsQueryStart(tokens[i]))
                {
                    i--;
                    break;
                }

                AddTokenSection(section, tokens[i]);
            }
            return section;
        }
Beispiel #6
0
 private void AddTokenSection(SqlSection parent, Token t)
 {
     parent.AddTokenSection(IsReservedWord(t), t);
 }
Beispiel #7
0
 public SqlOrderBy(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #8
0
 public SqlSection AddTokenSection(bool isReservedWord, params Token[] tokens)
 {
     var section =  new SqlSection(this, new SqlToken(isReservedWord, tokens));
     Sections.Add(section);
     return section;
 }
Beispiel #9
0
 //public List<SqlToken> Tokens { get; private set; }
 public SqlSection(SqlSection parent)
 {
     Parent = parent;
     Sections = new List<SqlSection>();
 }
Beispiel #10
0
 public SqlWhere(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #11
0
 public SqlFrom(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #12
0
 public SqlSelect(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #13
0
 public SqlQuery(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #14
0
 public SqlSection(SqlSection parent, SqlToken token)
 {
     Parent = parent;
     Token  = token;
 }
Beispiel #15
0
        //public List<SqlToken> Tokens { get; private set; }

        public SqlSection(SqlSection parent)
        {
            Parent   = parent;
            Sections = new List <SqlSection>();
        }
Beispiel #16
0
 public SqlHaving(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #17
0
 public SqlQuery(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #18
0
 public SqlOrderBy(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #19
0
 public SqlSection(SqlSection parent, SqlToken token)
 {
     Parent = parent;
     Token = token;
 }
Beispiel #20
0
 public SqlGroupBy(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #21
0
 public SqlSelect(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #22
0
 public SqlHaving(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #23
0
 public SqlWhere(SqlSection parent)
     : base(parent)
 {
 }
Beispiel #24
0
 public SqlFrom(SqlSection parent)
     : base(parent)
 {
 }