Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持kill <processlist_id>解析 #1326

Closed
terryzhu opened this issue Jul 12, 2016 · 1 comment
Closed

不支持kill <processlist_id>解析 #1326

terryzhu opened this issue Jul 12, 2016 · 1 comment
Milestone

Comments

@terryzhu
Copy link
Contributor

terryzhu commented Jul 12, 2016

mysql数据库支持KILL [CONNECTION | QUERY] processlist_id
druid库解析必须要让sql带有CONNECTION 或QUERY,与mysql行为不符合

麻烦修改,谢谢
附带个人修改方案MySqlStatementParser.java :

@Override
public SQLStatement parseKill() {
    accept(Token.KILL);

    MySqlKillStatement stmt = new MySqlKillStatement();

    if (identifierEquals("CONNECTION")) {
        System.out.println(lexer.stringVal());
        stmt.setType(MySqlKillStatement.Type.CONNECTION);
        lexer.nextToken();
    } else if (identifierEquals("QUERY")) {
        stmt.setType(MySqlKillStatement.Type.QUERY);
        lexer.nextToken();
    } else if (lexer.token() == Token.LITERAL_INT) {
        try {
            Long.parseLong(lexer.numberString());
            // if no [QUERY|CONNECTION], the behavior is same as CONNECTION
            // by MYSQL 5.6.24
            stmt.setType(MySqlKillStatement.Type.CONNECTION);
        } catch (Exception e) {
            throw new ParserException("not support kill " + lexer.numberString());
        }
    } else {
        throw new ParserException("not support kill type " + lexer.token());
    }
    SQLExpr threadId = this.exprParser.expr();
    stmt.setThreadId(threadId);
    return stmt;
}
@wenshao wenshao added this to the 1.0.23 milestone Jul 13, 2016
@wenshao
Copy link
Member

wenshao commented Jul 13, 2016

已完整支持,请等待下一个版本1.0.23发布吧

@wenshao wenshao closed this as completed Jul 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants