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

RouterUtil.removeSchema 移除schema不完全 #1316

Closed
young52656 opened this issue Dec 28, 2016 · 1 comment
Closed

RouterUtil.removeSchema 移除schema不完全 #1316

young52656 opened this issue Dec 28, 2016 · 1 comment

Comments

@young52656
Copy link

我的sql如下

select `test`.`User`.`id`, `test`.`User`.`name`, `test`.`User`.`age`, `test`.`User`.`created` from `test`.`User` where `test`.`User`.`id` = 1。

其中test为schema名,我发现该方法用flag标识了是否含有'`'反引号。但是只处理了一次,所以我执行该方法的时候,的结果为:

select `User`.`id`, `test`.`User`.`name`, `test`.`User`.`age`, `test`.`User`.`created` from `test`.`User` where `test`.`User`.`id` = 1。

这时候就报find no Route错误。

特殊处理反引号的地方

if (indx < 0) {
			StringBuilder sb = new StringBuilder("`").append(
					schema.toUpperCase()).append("`.");
			indx = upStmt.indexOf(sb.toString(), strtPos);
			flag = true;
			if (indx < 0) {
				return stmt;
			}
		}

其中sb是包含了反引号

indx = upStmt.indexOf(upSchema, strtPos);

这里的代码是while循环的,这时候upSchema不包含反引号。我上面的例子就返回-1。其实里面还有很多schema需要移除。

@HashJang
Copy link
Contributor

已提

magicdoom added a commit that referenced this issue Dec 31, 2016
[Bug](Issues #1316) 修正移除schema的方法
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