Search in sources :

Example 26 with DQLMergeEngine

use of io.shardingjdbc.core.merger.dql.DQLMergeEngine in project sharding-jdbc by shardingjdbc.

the class TopAndRowNumberDecoratorMergedResultTest method assertNextWithOffsetBoundOpenedFalse.

@Test
public void assertNextWithOffsetBoundOpenedFalse() throws SQLException {
    Limit limit = new Limit(DatabaseType.SQLServer);
    limit.setOffset(new LimitValue(2, -1, false));
    limit.setRowCount(new LimitValue(4, -1, false));
    selectStatement.setLimit(limit);
    mergeEngine = new DQLMergeEngine(queryResults, selectStatement);
    MergedResult actual = mergeEngine.merge();
    assertTrue(actual.next());
    assertTrue(actual.next());
    assertFalse(actual.next());
}
Also used : MergedResult(io.shardingjdbc.core.merger.MergedResult) DQLMergeEngine(io.shardingjdbc.core.merger.dql.DQLMergeEngine) Limit(io.shardingjdbc.core.parsing.parser.context.limit.Limit) LimitValue(io.shardingjdbc.core.parsing.parser.context.limit.LimitValue) Test(org.junit.Test)

Aggregations

MergedResult (io.shardingjdbc.core.merger.MergedResult)26 DQLMergeEngine (io.shardingjdbc.core.merger.dql.DQLMergeEngine)26 Test (org.junit.Test)26 Limit (io.shardingjdbc.core.parsing.parser.context.limit.Limit)12 LimitValue (io.shardingjdbc.core.parsing.parser.context.limit.LimitValue)11 BigDecimal (java.math.BigDecimal)3 TestQueryResult (io.shardingjdbc.core.merger.fixture.TestQueryResult)2 QueryResult (io.shardingjdbc.core.merger.QueryResult)1 Date (java.util.Date)1