in src/main/java/com/aliyun/odps/jdbc/OdpsStatement.java [353:375]
public static boolean isQuery(String sql) throws SQLException {
BufferedReader reader = new BufferedReader(new StringReader(sql));
try {
String line;
while ((line = reader.readLine()) != null) {
if (line.matches("^\\s*(--|#).*")) { // skip the comment starting with '--' or '#'
continue;
}
if (line.matches("^\\s*$")) { // skip the whitespace line
continue;
}
// The first none-comment line start with "select"
if (line.matches("(?i)^(\\s*)(SELECT).*$")) {
return true;
} else {
break;
}
}
} catch (IOException e) {
throw new SQLException(e.getMessage(), e);
}
return false;
}