Ejemplo n.º 1
0
        public TSQLStatement Parse()
        {
            TSQLWithClause with = new TSQLWithClauseParser().Parse(Tokenizer);

            if (Tokenizer.Current.IsKeyword(TSQLKeywords.SELECT) ||
                Tokenizer.Current.IsCharacter(TSQLCharacters.OpenParentheses))
            {
                return(new TSQLSelectStatementParser(with, Tokenizer).Parse());
            }
            else if (Tokenizer.Current.IsKeyword(TSQLKeywords.MERGE))
            {
                return(new TSQLMergeStatementParser(with, Tokenizer).Parse());
            }
            else if (Tokenizer.Current.IsKeyword(TSQLKeywords.UPDATE))
            {
                return(new TSQLUpdateStatementParser(with, Tokenizer).Parse());
            }
            else if (Tokenizer.Current.IsKeyword(TSQLKeywords.DELETE))
            {
                return(new TSQLDeleteStatementParser(with, Tokenizer).Parse());
            }
            else if (Tokenizer.Current.IsKeyword(TSQLKeywords.INSERT))
            {
                return(new TSQLInsertStatementParser(with, Tokenizer).Parse());
            }
            else
            {
                // TSQLUnknownStatement doesn't have a With property
                return(new TSQLUnknownStatementParser(with.Tokens, Tokenizer).Parse());
            }
        }
Ejemplo n.º 2
0
        public TSQLStatement Parse()
        {
            TSQLWithClause with = new TSQLWithClauseParser().Parse(Tokenizer);

            if (Tokenizer.Current.AsKeyword?.Keyword == TSQLKeywords.SELECT)
            {
                return(new TSQLSelectStatementParser(with, Tokenizer).Parse());
            }
            else
            {
                return(new TSQLUnknownStatementParser(with.Tokens, Tokenizer).Parse());
            }
        }