Example #1
0
        private IExpression CreatePartitionScheme(TextSpan token, IParser parser)
        {
            parser.Scanner.Consume(SqlToken.Scheme);
            var schemeName = parser.ConsumeObjectId();

            parser.Scanner.Consume(SqlToken.As);
            parser.Scanner.Consume(SqlToken.Partition);

            var funcName = parser.ConsumeObjectId();

            parser.Scanner.TryConsumeString(SqlToken.ALL, out var allToken);
            parser.Scanner.Consume(SqlToken.To);

            var groupNameList = new List <SqlCodeExpr>();

            parser.Scanner.Consume(SqlToken.LParen);
            do
            {
                groupNameList.Add(parser.ConsumePrimary());
            } while (parser.Scanner.Match(SqlToken.Comma));

            parser.Scanner.Consume(SqlToken.RParen);

            return(new CreatePartitionSchemeSqlCodeExpr
            {
                SchemeName = schemeName,
                FuncName = funcName,
                AllToken = allToken,
                GroupNameList = groupNameList
            });
        }