Skip to content
New issue

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

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

Already on GitHub? # to your account

SQLUpdateStatement#output 输出where有误,直接调用了Object的toString #2015

Closed
miuy56dc opened this issue Sep 28, 2017 · 2 comments
Closed
Labels
Milestone

Comments

@miuy56dc
Copy link

Druid版本1.1.3
输入update语句

update t set a=1,b=2 where a > 1

Parse 之后调用SQLUpdateStatement的 output语句输出:

UPDATE t SET a = 1, b = 2 WHERE com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr@ca624a2d

调用输出的时候调用了 SQLObjectImpl

public void output(StringBuffer buf) {
        buf.append(super.toString());
    }

这里直接调用了Object的 toString,导致失败

@wenshao wenshao added the Bug label Sep 28, 2017
@wenshao wenshao added this to the 1.1.4 milestone Sep 28, 2017
wenshao added a commit that referenced this issue Sep 28, 2017
@wenshao
Copy link
Member

wenshao commented Oct 3, 2017

https://github.com/alibaba/druid/releases/tag/1.1.4
问题已经修复,请使用新版本

@wenshao wenshao closed this as completed Oct 3, 2017
@fly0wing
Copy link

我也遇到了类似的问题,版本1.1.4.
String sql = "select t1.a-t2.b as a from t1 join t2 on t1.z=t2.z where t2.c='1'";
MySqlSelectParser parser = new MySqlSelectParser(sql);
MySqlSelectQueryBlock query = (MySqlSelectQueryBlock) parser.query();
System.out.println("from\t:" + query.getFrom().toString());

输出:
from :t1 JOIN t2 ON com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr@cb3f030

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants