fdb-sql-parser-1.6.1.jar包下载地址:[点此进入]。
代码如下:
/**
* 判断是否为select语句
* @param sql
* @return
*/
private boolean isSelectSql(String sql){
boolean flag = false;
SQLParser parser = new SQLParser();
StatementNode stmt = null;
try {
stmt = parser.parseStatement(sql);
} catch (StandardException e) {
e.printStackTrace();
}
if("SELECT".equals(stmt.statementToString())){
flag = true;
}
return flag;
}