use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class H2PagingTransformerTest method testOffsetLimit_forUpdate_semicolon.
@Test
public void testOffsetLimit_forUpdate_semicolon() {
String expected = "select * from emp order by emp.id limit 10 offset 5 for update;";
H2PagingTransformer transformer = new H2PagingTransformer(5, 10);
SqlParser parser = new SqlParser("select * from emp order by emp.id for update;");
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 H2PagingTransformerTest method testLimitOnly.
@Test
public void testLimitOnly() {
String expected = "select * from emp order by emp.id limit 10";
H2PagingTransformer transformer = new H2PagingTransformer(-1, 10);
SqlParser parser = new SqlParser("select * 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 H2PagingTransformerTest method testOffsetLimit_semicolon.
@Test
public void testOffsetLimit_semicolon() {
String expected = "select * from emp order by emp.id limit 10 offset 5;";
H2PagingTransformer transformer = new H2PagingTransformer(5, 10);
SqlParser parser = new SqlParser("select * 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 H2PagingTransformerTest method testOffsetOnly.
@Test
public void testOffsetOnly() {
String expected = "select * from emp order by emp.id limit -1 offset 5";
H2PagingTransformer transformer = new H2PagingTransformer(5, -1);
SqlParser parser = new SqlParser("select * 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 Mssql2008ForUpdateTransformerTest method testForUpdateNormal_originalSqlNodeUnchanged.
@Test
public void testForUpdateNormal_originalSqlNodeUnchanged() {
String original = "select * from emp order by emp.id";
Mssql2008ForUpdateTransformer transformer = new Mssql2008ForUpdateTransformer(SelectForUpdateType.NORMAL, 0);
SqlParser parser = new SqlParser(original);
SqlNode originalSqlNode = parser.parse();
SqlNode sqlNode = transformer.transform(originalSqlNode);
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
sqlBuilder.build(sqlNode, Function.identity());
sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(originalSqlNode, Function.identity());
assertEquals(original, sql.getRawSql());
}
Aggregations