提交 3053b2dd authored 作者: Thomas Mueller's avatar Thomas Mueller

SQL statements with a non-breaking space were considered invalid.

上级 94e4097b
......@@ -60,7 +60,7 @@ class RuleElement implements Rule {
String up = sentence.getQueryUpper().trim();
if (up.startsWith(name)) {
query = query.substring(name.length());
while (!"_".equals(name) && query.length() > 0 && Character.isWhitespace(query.charAt(0))) {
while (!"_".equals(name) && query.length() > 0 && Character.isSpaceChar(query.charAt(0))) {
query = query.substring(1);
}
sentence.setQuery(query);
......
......@@ -108,7 +108,7 @@ public class RuleFixed implements Rule {
}
break;
case ANY_WORD:
while (s.length() > 0 && !Character.isWhitespace(s.charAt(0))) {
while (s.length() > 0 && !Character.isSpaceChar(s.charAt(0))) {
s = s.substring(1);
}
if (s.length() == 0) {
......@@ -182,7 +182,7 @@ public class RuleFixed implements Rule {
throw new AssertionError("type="+type);
}
if (!s.equals(query)) {
while (s.length() > 0 && Character.isWhitespace(s.charAt(0))) {
while (s.length() > 0 && Character.isSpaceChar(s.charAt(0))) {
s = s.substring(1);
}
sentence.setQuery(s);
......
......@@ -176,7 +176,7 @@ public class DbContextRule implements Rule {
throw DbException.throwInternalError("type=" + type);
}
if (!s.equals(query)) {
while (s.length() > 0 && Character.isWhitespace(s.charAt(0))) {
while (s.length() > 0 && Character.isSpaceChar(s.charAt(0))) {
s = s.substring(1);
}
sentence.setQuery(s);
......
......@@ -287,7 +287,7 @@ public class WebApp {
String space = "";
if (sql.length() > 0) {
char last = sql.charAt(sql.length() - 1);
if (!Character.isWhitespace(last) && (last != '.' && last >= ' ' && last != '\'' && last != '"')) {
if (!Character.isSpaceChar(last) && (last != '.' && last >= ' ' && last != '\'' && last != '"')) {
space = " ";
}
}
......
......@@ -195,7 +195,7 @@ public class PrepareTranslation {
private static String getSpace(String s, boolean start) {
if (start) {
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i))) {
if (!Character.isSpaceChar(s.charAt(i))) {
if (i == 0) {
return "";
}
......@@ -205,7 +205,7 @@ public class PrepareTranslation {
return s;
}
for (int i = s.length() - 1; i >= 0; i--) {
if (!Character.isWhitespace(s.charAt(i))) {
if (!Character.isSpaceChar(s.charAt(i))) {
if (i == s.length() - 1) {
return "";
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论