Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.Limit


        List<ColumnExpression> columnExpressions = parseSelect(tokens, isDistinct, typeSystem);
        Source source = parseFrom(tokens, typeSystem);
        Constraint constraint = parseWhere(tokens, typeSystem, source);
        // Parse the order by and limit (can be in any order) ...
        List<? extends Ordering> orderings = parseOrderBy(tokens, typeSystem, source);
        Limit limit = parseLimit(tokens);
        if (orderings == null) parseOrderBy(tokens, typeSystem, source);

        // Convert the column expressions to columns ...
        List<Column> columns = new ArrayList<Column>(columnExpressions.size());
        for (ColumnExpression expression : columnExpressions) {
View Full Code Here


        return new SameNodeJoinCondition(selector1, selector2, path);
    }

    protected Limit limit( int rowCount,
                           int offset ) {
        return new Limit(rowCount, offset);
    }
View Full Code Here

                assert plan.getChildCount() == 1;
                rows = createNodeSequence(originalQuery, context, plan.getFirstChild(), columns, sources);
                // Calculate the limit ...
                Integer rowLimit = plan.getProperty(Property.LIMIT_COUNT, Integer.class);
                Integer offset = plan.getProperty(Property.LIMIT_OFFSET, Integer.class);
                Limit limit = Limit.NONE;
                if (rowLimit != null) limit = limit.withRowLimit(rowLimit.intValue());
                if (offset != null) limit = limit.withOffset(offset.intValue());
                // Then create the limited sequence ...
                if (!limit.isUnlimited()) {
                    rows = NodeSequence.limit(rows, limit);
                }
                break;
            case NULL:
                // No results ...
View Full Code Here

    // parseLimit
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseLimitFromFormWithJustOneNumber() {
        Limit limit = parser.parseLimit(tokens("LIMIT 10"));
        assertThat(limit.getRowLimit(), is(10));
        assertThat(limit.getOffset(), is(0));

        limit = parser.parseLimit(tokens("LIMIT 10 NONOFFSET"));
        assertThat(limit.getRowLimit(), is(10));
        assertThat(limit.getOffset(), is(0));
    }
View Full Code Here

        assertThat(limit.getOffset(), is(0));
    }

    @Test
    public void shouldParseLimitFromFormWithRowLimitAndOffset() {
        Limit limit = parser.parseLimit(tokens("LIMIT 10 OFFSET 30"));
        assertThat(limit.getRowLimit(), is(10));
        assertThat(limit.getOffset(), is(30));

        limit = parser.parseLimit(tokens("LIMIT 10 OFFSET 30 OTHER"));
        assertThat(limit.getRowLimit(), is(10));
        assertThat(limit.getOffset(), is(30));
    }
View Full Code Here

        assertThat(limit.getOffset(), is(30));
    }

    @Test
    public void shouldParseLimitFromFormWithTwoCommaSeparatedNumbers() {
        Limit limit = parser.parseLimit(tokens("LIMIT 10,30"));
        assertThat(limit.getRowLimit(), is(20));
        assertThat(limit.getOffset(), is(10));
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.model.Limit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.