use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class MssqlPagingTransformerTest method testOffsetLimit.
@Test
public void testOffsetLimit() {
String expected = "select emp.id from emp order by emp.id offset 5 rows fetch next 10 rows only";
MssqlPagingTransformer transformer = new MssqlPagingTransformer(5, 10, false);
SqlParser parser = new SqlParser("select emp.id from emp order by emp.id");
SqlNode sqlNode = transformer.transform(parser.parse());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class MssqlPagingTransformerTest method testLimitOnly_option_forceOffsetFetch.
@Test
public void testLimitOnly_option_forceOffsetFetch() {
String expected = "select emp.id from emp order by emp.id offset 0 rows fetch next 10 rows only option (maxrecursion 0)";
MssqlPagingTransformer transformer = new MssqlPagingTransformer(-1, 10, true);
SqlParser parser = new SqlParser("select emp.id from emp order by emp.id option (maxrecursion 0)");
SqlNode sqlNode = transformer.transform(parser.parse());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class MssqlPagingTransformerTest method testOffsetOnly.
@Test
public void testOffsetOnly() {
String expected = "select emp.id from emp order by emp.id offset 5 rows";
MssqlPagingTransformer transformer = new MssqlPagingTransformer(5, -1, false);
SqlParser parser = new SqlParser("select emp.id from emp order by emp.id");
SqlNode sqlNode = transformer.transform(parser.parse());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class MssqlPagingTransformerTest method testLimitOnly_forceOffsetFetch.
@Test
public void testLimitOnly_forceOffsetFetch() {
String expected = "select emp.id from emp order by emp.id offset 0 rows fetch next 10 rows only";
MssqlPagingTransformer transformer = new MssqlPagingTransformer(-1, 10, true);
SqlParser parser = new SqlParser("select emp.id from emp order by emp.id");
SqlNode sqlNode = transformer.transform(parser.parse());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class MssqlPagingTransformerTest method testOffsetOnly_forceOffsetFetch.
@Test
public void testOffsetOnly_forceOffsetFetch() {
String expected = "select emp.id from emp order by emp.id offset 5 rows";
MssqlPagingTransformer transformer = new MssqlPagingTransformer(5, -1, true);
SqlParser parser = new SqlParser("select emp.id from emp order by emp.id");
SqlNode sqlNode = transformer.transform(parser.parse());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
Aggregations