开发者

Is there any java library to format SQL?

I am looking for a simple library [free] wherein i can use something like this:-

String formattedSQL = xyzLib.format开发者_Python百科 ( sql );

Is there any such library? Or is there a way to format the SQL?


I'm not aware of a library that does this, but you might look at Hibernate's SQL formatter. From my experience it does a pretty good job at prettifying SQL statements, but as always, it might not be exactly what you want.


Yohei Yamana (vertical-blank) has written an open source, pure-Java standalone, zero-dependencies SQL Formatter. It is available from maven central:

<dependency>
  <groupId>com.github.vertical-blank</groupId>
  <artifactId>sql-formatter</artifactId>
  <version>1.0</version>
</dependency>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜