Пример #1
0
        public override SqlObject VisitTop_spec([NotNull] sqlParser.Top_specContext context)
        {
            Contract.Requires(context != null);

            Number64 topCount = CstToAstVisitor.GetNumber64ValueFromNode(context.NUMERIC_LITERAL());

            return(SqlTopSpec.Create(SqlNumberLiteral.Create(topCount)));
        }
        public override SqlObject VisitTop_spec([NotNull] sqlParser.Top_specContext context)
        {
            Contract.Requires(context != null);

            SqlTopSpec sqlTopSpec;

            if (context.NUMERIC_LITERAL() != null)
            {
                Number64 topCount = CstToAstVisitor.GetNumber64ValueFromNode(context.NUMERIC_LITERAL());
                sqlTopSpec = SqlTopSpec.Create(SqlNumberLiteral.Create(topCount));
            }
            else if (context.PARAMETER() != null)
            {
                sqlTopSpec = SqlTopSpec.Create(SqlParameter.Create(context.PARAMETER().GetText()));
            }
            else
            {
                throw new InvalidOperationException();
            }

            return(sqlTopSpec);
        }