use of io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement in project sharding-jdbc by shardingjdbc.
the class LimitDecoratorMergedResultTest method setUp.
@Before
public void setUp() throws SQLException {
ResultSet resultSet = mock(ResultSet.class);
ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class);
when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
List<ResultSet> resultSets = Lists.newArrayList(resultSet, mock(ResultSet.class), mock(ResultSet.class), mock(ResultSet.class));
for (ResultSet each : resultSets) {
when(each.next()).thenReturn(true, true, false);
}
queryResults = new ArrayList<>(resultSets.size());
for (ResultSet each : resultSets) {
queryResults.add(new TestQueryResult(each));
}
selectStatement = new SelectStatement();
}
use of io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement in project sharding-jdbc by shardingjdbc.
the class RowNumberDecoratorMergedResultTest method setUp.
@Before
public void setUp() throws SQLException {
ResultSet resultSet = mock(ResultSet.class);
ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class);
when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
List<ResultSet> resultSets = Lists.newArrayList(resultSet, mock(ResultSet.class), mock(ResultSet.class), mock(ResultSet.class));
for (ResultSet each : resultSets) {
when(each.next()).thenReturn(true, true, false);
}
queryResults = new ArrayList<>(resultSets.size());
for (ResultSet each : resultSets) {
queryResults.add(new TestQueryResult(each));
}
selectStatement = new SelectStatement();
}
use of io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement in project sharding-jdbc by shardingjdbc.
the class TopAndRowNumberDecoratorMergedResultTest method setUp.
@Before
public void setUp() throws SQLException {
ResultSet resultSet = mock(ResultSet.class);
ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class);
when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
List<ResultSet> resultSets = Lists.newArrayList(resultSet, mock(ResultSet.class), mock(ResultSet.class), mock(ResultSet.class));
for (ResultSet each : resultSets) {
when(each.next()).thenReturn(true, true, false);
}
queryResults = new ArrayList<>(resultSets.size());
for (ResultSet each : resultSets) {
queryResults.add(new TestQueryResult(each));
}
selectStatement = new SelectStatement();
}
use of io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement in project sharding-jdbc by shardingjdbc.
the class SelectStatementTest method assertIsSameGroupByAndOrderByItemsWhenDifferent.
@Test
public void assertIsSameGroupByAndOrderByItemsWhenDifferent() {
SelectStatement actual = new SelectStatement();
actual.getOrderByItems().add(new OrderItem("order_col", OrderDirection.ASC, OrderDirection.ASC, Optional.<String>absent()));
actual.getGroupByItems().add(new OrderItem("group_col", OrderDirection.ASC, OrderDirection.ASC, Optional.<String>absent()));
assertFalse(actual.isSameGroupByAndOrderByItems());
}
use of io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement in project sharding-jdbc by shardingjdbc.
the class SelectStatementTest method assertIsSameGroupByAndOrderByItemsWhenSame.
@Test
public void assertIsSameGroupByAndOrderByItemsWhenSame() {
SelectStatement actual = new SelectStatement();
actual.getOrderByItems().add(new OrderItem("col", OrderDirection.ASC, OrderDirection.ASC, Optional.<String>absent()));
actual.getGroupByItems().add(new OrderItem("col", OrderDirection.ASC, OrderDirection.ASC, Optional.<String>absent()));
assertTrue(actual.isSameGroupByAndOrderByItems());
}
Aggregations