use of org.seasar.doma.internal.jdbc.sql.SqlParser in project doma by domaframework.
the class JdbcExceptionTest method testQuotationNotClosed.
@Test
public void testQuotationNotClosed() {
SqlParser parser = new SqlParser("select * from 'aaa");
try {
parser.parse();
fail();
} catch (JdbcException e) {
System.out.println(e.getMessage());
assertEquals(Message.DOMA2101, e.getMessageResource());
}
}
use of org.seasar.doma.internal.jdbc.sql.SqlParser in project doma by domaframework.
the class JdbcExceptionTest method testBlockCommentNotClosed.
@Test
public void testBlockCommentNotClosed() {
SqlParser parser = new SqlParser("select * from aaa /*aaa");
try {
parser.parse();
fail();
} catch (JdbcException e) {
System.out.println(e.getMessage());
assertEquals(Message.DOMA2102, e.getMessageResource());
}
}
use of org.seasar.doma.internal.jdbc.sql.SqlParser in project doma by domaframework.
the class JdbcExceptionTest method testTestLiteralNotFound.
@Test
public void testTestLiteralNotFound() {
SqlParser parser = new SqlParser("select * from aaa where bbb = /*bbb*/ 'ccc')");
try {
parser.parse();
fail();
} catch (JdbcException e) {
System.out.println(e.getMessage());
assertEquals(Message.DOMA2110, e.getMessageResource());
}
}
use of org.seasar.doma.internal.jdbc.sql.SqlParser in project doma by domaframework.
the class JdbcExceptionTest method testIfCommentNotFoundForEndComment.
@Test
public void testIfCommentNotFoundForEndComment() {
SqlParser parser = new SqlParser("select * from aaa/*%end*/ ");
try {
parser.parse();
fail();
} catch (JdbcException e) {
System.out.println(e.getMessage());
assertEquals(Message.DOMA2104, e.getMessageResource());
}
}
use of org.seasar.doma.internal.jdbc.sql.SqlParser in project doma by domaframework.
the class JdbcExceptionTest method testCollectionOfBindValueContainsNull.
@Test
public void testCollectionOfBindValueContainsNull() {
SqlParser parser = new SqlParser("select * from aaa where bbb in /*bbb*/(1,2,3)");
SqlNode sqlNode = parser.parse();
ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.add("bbb", new Value(List.class, Arrays.asList(1, null)));
NodePreparedSqlBuilder builder = new NodePreparedSqlBuilder(config, SqlKind.SELECT, "dummyPath", evaluator, SqlLogType.FORMATTED);
try {
builder.build(sqlNode, Function.identity());
fail();
} catch (JdbcException e) {
System.out.println(e.getMessage());
assertEquals(Message.DOMA2115, e.getMessageResource());
}
}
Aggregations