Exemplo n.º 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)));
        }
Exemplo n.º 2
0
        public QueryUnderConstruction AddTopSpec(SqlTopSpec topSpec, HashSet <ParameterExpression> inScope, Collection currentCollection)
        {
            QueryUnderConstruction result = this;

            if (result.topSpec != null)
            {
                // Set the topSpec to the one with minimum Count value
                result.topSpec = (this.topSpec.Count < topSpec.Count) ? this.topSpec : topSpec;
            }
            else
            {
                result.topSpec = topSpec;
            }
            if (result.topSpec.Count < 0)
            {
                result.topSpec = SqlTopSpec.Create(0);
            }

            return(result);
        }
        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);
        }
 public override SqlObject Visit(SqlTopSpec sqlTopSpec)
 {
     return(SqlTopSpec.Create(SqlNumberLiteral.Create(0)));
 }