File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
main/java/org/seasar/doma/internal/jdbc/sql
test/java/org/seasar/doma/internal/jdbc/sql Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -732,10 +732,10 @@ protected SqlLocation getLocation() {
732732
733733 protected void validate () {
734734 if (isAfterValueNode ()) {
735- BindVariableNode bindVariableNode = pop ();
735+ ValueNode valueNode = pop ();
736736 throw new JdbcException (Message .DOMA2110 , sql ,
737737 tokenizer .getLineNumber (), tokenizer .getPosition (),
738- bindVariableNode .getText ());
738+ valueNode .getText ());
739739 }
740740 if (isInIfBlockNode ()) {
741741 removeNodesTo (IfBlockNode .class );
Original file line number Diff line number Diff line change @@ -264,6 +264,33 @@ public void testLiteralVariable_in() throws Exception {
264264 assertEquals (0 , sql .getParameters ().size ());
265265 }
266266
267+ public void testLiteralVariable_endsWithLiteralVariableComment ()
268+ throws Exception {
269+ ExpressionEvaluator evaluator = new ExpressionEvaluator ();
270+ evaluator .add ("name" , new Value (String .class , "hoge" ));
271+ String testSql = "select * from aaa where ename = /*^name*/" ;
272+ SqlParser parser = new SqlParser (testSql );
273+ try {
274+ parser .parse ();
275+ fail ();
276+ } catch (JdbcException expected ) {
277+ System .out .println (expected .getMessage ());
278+ assertEquals (Message .DOMA2110 , expected .getMessageResource ());
279+ }
280+ }
281+
282+ public void testLiteralVariable_illegalLiteral () throws Exception {
283+ String testSql = "select * from aaa where ename = /*^name*/bbb" ;
284+ SqlParser parser = new SqlParser (testSql );
285+ try {
286+ parser .parse ();
287+ fail ();
288+ } catch (JdbcException expected ) {
289+ System .out .println (expected .getMessage ());
290+ assertEquals (Message .DOMA2142 , expected .getMessageResource ());
291+ }
292+ }
293+
267294 public void testEmbeddedVariable () throws Exception {
268295 ExpressionEvaluator evaluator = new ExpressionEvaluator ();
269296 evaluator .add ("name" , new Value (String .class , "hoge" ));
You can’t perform that action at this time.
0 commit comments