String expr3 = "expr3";
String expr4 = "expr4";
String expr5 = "expr5";
// 编译下列语句
ExqlPattern pattern = ExqlPatternImpl
.compile("SELECT #(:expr1.length()), #($expr2.bytes[:expr1.length() - 1]),"
+ " $expr3 WHERE #if($expr4) {e = :expr4} #else {e IS NULL}"
+ "#for(variant in $expr5.bytes) { AND c = :variant}" // NL
+ " GROUP BY $expr1 ASC");
ExqlContext context = new ExqlContextImpl(1024);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("expr1", expr1);
map.put("expr2", expr2);
map.put("expr3", expr3);
map.put("expr4", expr4);
map.put("expr5", expr5);
Assert.assertEquals("SELECT ?, ?, expr3 WHERE e = ? AND c = ? AND c = ? "
+ "AND c = ? AND c = ? AND c = ? GROUP BY expr1 ASC", // NL
pattern.execute(context, map, map));
Object[] expectArray = new Object[] { expr1.length(), expr2.getBytes()[expr1.length() - 1],
expr4, expr5.getBytes()[0], expr5.getBytes()[1], expr5.getBytes()[2],
expr5.getBytes()[3], expr5.getBytes()[4] };
Object[] paramArray = context.getParams();