use of org.dbflute.twowaysql.exception.InLoopOptionOutOfLoopException in project dbflute-core by dbflute.
the class NodeChecker method throwInLoopOptionOutOfLoopException.
public static void throwInLoopOptionOutOfLoopException(String expression, String specifiedSql, String option) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The in-loop option of variable comment was out of loop.");
br.addItem("Advice");
br.addElement("The in-loop options are supported in loop only.");
br.addElement("For example:");
br.addElement(" (x):");
br.addElement(" /*pmb.memberName:notLike*/");
br.addElement(" /*FOR ...*/");
br.addElement(" /*END*/");
br.addElement(" (o):");
br.addElement(" /*FOR ...*/");
br.addElement(" /*pmb.memberName:notLike*/");
br.addElement(" /*END*/");
br.addItem("Comment Expression");
br.addElement(expression);
br.addItem("In-Loop Option");
br.addElement(option);
br.addItem("Specified SQL");
br.addElement(specifiedSql);
final String msg = br.buildExceptionMessage();
throw new InLoopOptionOutOfLoopException(msg);
}
use of org.dbflute.twowaysql.exception.InLoopOptionOutOfLoopException in project dbflute-core by dbflute.
the class BindVariableNodeTest method test_accept_inLoopOption_outOfLoop.
public void test_accept_inLoopOption_outOfLoop() {
// ## Arrange ##
String sql = "= /*pmb.memberName:notLike*/'foo'";
SqlAnalyzer analyzer = new SqlAnalyzer(sql, false);
Node rootNode = analyzer.analyze();
MockMemberPmb pmb = new MockMemberPmb();
pmb.setMemberName("bar");
CommandContext ctx = createCtx(pmb);
// ## Act ##
try {
rootNode.accept(ctx);
// ## Assert ##
fail();
} catch (InLoopOptionOutOfLoopException e) {
// OK
log(e.getMessage());
}
}
Aggregations