use of io.shardingjdbc.core.parsing.parser.context.limit.Limit in project sharding-jdbc by shardingjdbc.
the class LimitDecoratorMergedResultTest method assertNextWithoutRowCount.
@Test
public void assertNextWithoutRowCount() throws SQLException {
Limit limit = new Limit(DatabaseType.MySQL);
limit.setOffset(new LimitValue(2, -1, true));
selectStatement.setLimit(limit);
mergeEngine = new DQLMergeEngine(queryResults, selectStatement);
MergedResult actual = mergeEngine.merge();
for (int i = 0; i < 6; i++) {
assertTrue(actual.next());
}
assertFalse(actual.next());
}
use of io.shardingjdbc.core.parsing.parser.context.limit.Limit in project sharding-jdbc by shardingjdbc.
the class RowNumberDecoratorMergedResultTest method assertNextWithoutOffsetWithoutRowCount.
@Test
public void assertNextWithoutOffsetWithoutRowCount() throws SQLException {
Limit limit = new Limit(DatabaseType.Oracle);
selectStatement.setLimit(limit);
mergeEngine = new DQLMergeEngine(queryResults, selectStatement);
MergedResult actual = mergeEngine.merge();
for (int i = 0; i < 8; i++) {
assertTrue(actual.next());
}
assertFalse(actual.next());
}
use of io.shardingjdbc.core.parsing.parser.context.limit.Limit in project sharding-jdbc by shardingjdbc.
the class RowNumberDecoratorMergedResultTest method assertNextForRowCountBoundOpenedTrue.
@Test
public void assertNextForRowCountBoundOpenedTrue() throws SQLException {
Limit limit = new Limit(DatabaseType.Oracle);
limit.setOffset(new LimitValue(2, -1, true));
limit.setRowCount(new LimitValue(4, -1, true));
selectStatement.setLimit(limit);
mergeEngine = new DQLMergeEngine(queryResults, selectStatement);
MergedResult actual = mergeEngine.merge();
assertTrue(actual.next());
assertTrue(actual.next());
assertTrue(actual.next());
assertFalse(actual.next());
}
use of io.shardingjdbc.core.parsing.parser.context.limit.Limit in project sharding-jdbc by shardingjdbc.
the class TopAndRowNumberDecoratorMergedResultTest method assertNextWithOffsetBoundOpenedTrue.
@Test
public void assertNextWithOffsetBoundOpenedTrue() throws SQLException {
Limit limit = new Limit(DatabaseType.SQLServer);
limit.setOffset(new LimitValue(2, -1, true));
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());
assertTrue(actual.next());
assertFalse(actual.next());
}
use of io.shardingjdbc.core.parsing.parser.context.limit.Limit in project sharding-jdbc by shardingjdbc.
the class TopAndRowNumberDecoratorMergedResultTest method assertNextWithoutOffsetWithRowCount.
@Test
public void assertNextWithoutOffsetWithRowCount() throws SQLException {
Limit limit = new Limit(DatabaseType.SQLServer);
limit.setRowCount(new LimitValue(5, -1, false));
selectStatement.setLimit(limit);
mergeEngine = new DQLMergeEngine(queryResults, selectStatement);
MergedResult actual = mergeEngine.merge();
for (int i = 0; i < 5; i++) {
assertTrue(actual.next());
}
assertFalse(actual.next());
}
Aggregations