* 执行生成
*/
public void generate() throws DataAccessException {
// 将 :字段名 方式,转换为?方式
if (oraSql == null || "".equalsIgnoreCase(oraSql.trim())) {
throw new DataAccessException("SQL is null");
}
List<Object> arglist = new ArrayList<Object>();
Pattern p = Pattern.compile(PATTERN);
Matcher m = p.matcher(oraSql);
while (m.find()) {
String key = m.group();
if (!params.containsKey(key.substring(1))) {
// 参数列表中不包含该key
throw new DataAccessException("Params not contains key~" + key + ";");
}
arglist.add(params.get(key.substring(1))); // 添加参数列表
}
sql = oraSql.replaceAll(PATTERN, "?");