Esempio n. 1
0
        public override void ParseInside(ExpressionParser parser)
        {
            var collection = parser.Collection;
            var lex        = collection.CurrentLexem();

            if (lex.LexemText.ToLower() != "create")
            {
                parser.Collection.Error("error", collection.CurrentLexem());
            }
            lex = collection.GotoNextMust();
            if (lex.LexemText.ToLower() != "view")
            {
                parser.Collection.Error("error", collection.CurrentLexem());
            }
            lex = collection.GotoNextMust();
            //название
            Table = TableName.Parse(parser);
            lex   = collection.GotoNextMust();
            if (lex.IsSkobraOpen())
            {
                lex = collection.GotoNextMust();
                Columns.Clear();
                while (true)
                {
                    var col = CommonParserFunc.ReadColumnNameOnly(collection);
                    Columns.Add(col);
                    lex = collection.CurrentLexem();
                    if (lex == null)
                    {
                        parser.Collection.UnexceptEndError();
                    }
                    if (lex.LexemType == LexType.Zpt)
                    {
                        collection.GotoNextMust();
                        continue;
                    }
                    if (lex.IsSkobraClose())
                    {
                        break;
                    }
                    collection.ErrorUnexpected(collection.CurrentOrLast());
                }
                lex = collection.GotoNextMust();
            }
            lex = collection.CurrentLexem();
            if (lex.LexemText.ToLower() != "as")
            {
                parser.Collection.ErrorWaitKeyWord("AS", collection.CurrentLexem());
            }
            lex      = collection.GotoNextMust();
            AsSelect = new SelectExpresion();
            AsSelect.ParseInside(parser);

            //переходим к следующей лексеме
            collection.GotoNext();
        }