We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
对于DDL语句CREATE TABLE task_list01 ( id bigint(20) NOT NULL AUTO_INCREMENT, did bigint(20) DEFAULT NULL COMMENT '医生ID', uid bigint(20) DEFAULT NULL COMMENT '诊断人ID', PRIMARY KEY (id), UNIQUE KEY task(uid,did) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8,首先通过Druid得到AST,然后再使用MySqlOutputVisitor将AST转换为ddl语句后UNIQUE KEY就变成了UNIQUE KEY task USING BTREE (uid,did)。对于这个转换得到的语句使用Druid再进行parse时就报错了。所以在MySqlOutputVisitor中,解析MySqlUnique时应该先打印索引的列名,再打印USING BTREE。也就是如下代码:
CREATE TABLE task_list01 ( id bigint(20) NOT NULL AUTO_INCREMENT, did bigint(20) DEFAULT NULL COMMENT '医生ID', uid bigint(20) DEFAULT NULL COMMENT '诊断人ID', PRIMARY KEY (id), UNIQUE KEY task(uid,did) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8
public boolean visit(MySqlUnique x) { if (x.isHasConstaint()) { print("CONSTRAINT "); if (x.getName() != null) { x.getName().accept(this); print(' '); } } print("UNIQUE"); if (x.getIndexName() != null) { print(' '); x.getIndexName().accept(this); } print(" ("); printAndAccept(x.getColumns(), ", "); print(")"); if (x.getIndexType() != null) { print(" USING "); print(x.getIndexType()); } return false; }
The text was updated successfully, but these errors were encountered:
你来提交一个pull request吧,同时请带上testcase
Sorry, something went wrong.
好的
No branches or pull requests
对于DDL语句
CREATE TABLE task_list01 ( id bigint(20) NOT NULL AUTO_INCREMENT, did bigint(20) DEFAULT NULL COMMENT '医生ID', uid bigint(20) DEFAULT NULL COMMENT '诊断人ID', PRIMARY KEY (id), UNIQUE KEY task(uid,did) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8
,首先通过Druid得到AST,然后再使用MySqlOutputVisitor将AST转换为ddl语句后UNIQUE KEY就变成了UNIQUE KEY task USING BTREE (uid,did)。对于这个转换得到的语句使用Druid再进行parse时就报错了。所以在MySqlOutputVisitor中,解析MySqlUnique时应该先打印索引的列名,再打印USING BTREE。也就是如下代码:The text was updated successfully, but these errors were encountered: