mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
Fix: issue#2845 SqlUtil.formatSql 格式化的sql换行异常
This commit is contained in:
parent
0621543ae3
commit
ec1e13d3b1
@ -110,6 +110,12 @@ public class SqlFormatter {
|
||||
t = this.tokens.nextToken();
|
||||
this.token += t;
|
||||
} while (!"\"".equals(t));
|
||||
} else if ("`".equals(this.token)) {
|
||||
String t;
|
||||
do {
|
||||
t = this.tokens.nextToken();
|
||||
this.token += t;
|
||||
} while (!"`".equals(t));
|
||||
}
|
||||
|
||||
if ((this.afterByOrSetOrFromOrSelect) && (",".equals(this.token))) {
|
||||
|
@ -11,4 +11,11 @@ public class SqlFormatterTest {
|
||||
String sql = "(select 1 from dual) union all (select 1 from dual)";
|
||||
SqlFormatter.format(sql);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeyword() {
|
||||
String sql = "select * from `order`";
|
||||
String format = SqlFormatter.format(sql);
|
||||
System.out.println(format);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user