提交 08d05009 编写于 作者: S Serge Rider

SQL semantic processing + filters update fix (compare column names ignoring whitespaces)

上级 aad65da0
...@@ -632,6 +632,10 @@ public final class SQLUtils { ...@@ -632,6 +632,10 @@ public final class SQLUtils {
return hasFixes ? String.valueOf(fixed) : sql; return hasFixes ? String.valueOf(fixed) : sql;
} }
/**
* Compares two string ignoring extra whitespaces.
* We can remove double whitespaces and any whitespaces between special chars (*-+,: etc).
*/
public static boolean equalsWithoutExtraSpaces(String str1, String str2) { public static boolean equalsWithoutExtraSpaces(String str1, String str2) {
return removeExtraSpaces(str1).equals(removeExtraSpaces(str2)); return removeExtraSpaces(str1).equals(removeExtraSpaces(str2));
} }
...@@ -645,7 +649,7 @@ public final class SQLUtils { ...@@ -645,7 +649,7 @@ public final class SQLUtils {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
char c = str.charAt(i); char c = str.charAt(i);
if (Character.isWhitespace(c)) { if (Character.isWhitespace(c)) {
boolean needsSpace = Character.isLetterOrDigit(c); boolean needsSpace = i > 0 && Character.isLetterOrDigit(str.charAt(i - 1));
for (i = i + 1; i < length; i++) { for (i = i + 1; i < length; i++) {
c = str.charAt(i); c = str.charAt(i);
if (Character.isWhitespace(c)) { if (Character.isWhitespace(c)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册