use of org.dbflute.twowaysql.exception.IfCommentConditionEmptyException in project dbflute-core by dbflute.
the class SqlAnalyzer method throwIfCommentConditionEmptyException.
protected void throwIfCommentConditionEmptyException() {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The condition of IF comment was empty!");
br.addItem("Advice");
br.addElement("Please confirm the IF comment expression.");
br.addElement("Your IF comment might not have a condition.");
br.addElement("For example:");
br.addElement(" (x) - /*IF */XXX_ID = /*pmb.xxxId*/3/*END*/");
br.addElement(" (o) - /*IF pmb.xxxId != null*/XXX_ID = /*pmb.xxxId*/3/*END*/");
br.addItem("IF Comment");
br.addElement(_tokenizer.getToken());
br.addItem("Specified SQL");
br.addElement(_specifiedSql);
final String msg = br.buildExceptionMessage();
throw new IfCommentConditionEmptyException(msg);
}
use of org.dbflute.twowaysql.exception.IfCommentConditionEmptyException in project dbflute-core by dbflute.
the class IfNodeTest method test_parse_IF_emptyCondition.
public void test_parse_IF_emptyCondition() {
// ## Arrange ##
String sql = "where";
sql = sql + " /*IF */";
sql = sql + " select foo";
sql = sql + " /*END*/";
SqlAnalyzer analyzer = new SqlAnalyzer(sql, false);
// ## Act ##
try {
analyzer.analyze();
// ## Assert ##
fail();
} catch (IfCommentConditionEmptyException e) {
// OK
log(e.getMessage());
}
}
use of org.dbflute.twowaysql.exception.IfCommentConditionEmptyException in project dbflute-core by dbflute.
the class OutsideSqlCheckerTest method test_check_parameterComment.
public void test_check_parameterComment() {
// ## Arrange ##
DfOutsideSqlChecker ker = new DfOutsideSqlChecker();
String fn = "test.sql";
// ## Act ##
try {
ker.check(fn, "-- #df:entity#\n-- !df:pmb!\nfoo /*IF pmb.memberId != null*/bar");
// ## Assert ##
fail();
} catch (EndCommentNotFoundException e) {
// OK
log(e.getMessage());
}
// ## Act ##
try {
ker.check(fn, "-- #df:entity#\n-- !df:pmb!\nfoo /*IF */bar/*END*/");
// ## Assert ##
fail();
} catch (IfCommentConditionEmptyException e) {
// OK
log(e.getMessage());
}
}
Aggregations