问题描述
我正在寻找一个Java开源美化器或SQL重新格式化程序,我可以用它来清理我用。
I am looking for a Java open source beautifier or reformatter for SQL that I can use to clean up DDL statements that I am generating with openArchitectureWare.
对我有用,我无法得到为我工作。
Nothing in the answer to "Online Code Beautifier And Formatter" is of use to me and I have not been able to get Simple SQL Formatter to work for me.
推荐答案
更新2:
org.hibernate.jdbc.util.BasicFormatterImpl
已在4.0版本中移动。它现在位于: org.hibernate.engine.jdbc.internal.BasicFormatterImpl
。
org.hibernate.jdbc.util.BasicFormatterImpl
got moved in release 4.0. It is now located at: org.hibernate.engine.jdbc.internal.BasicFormatterImpl
.
UPDATE 1:
技术进步。如Alex所述, org.hibernate.pretty.Formatter
自版本3.3.2.GA 后不再存在。替换是 org.hibernate.jdbc.util.BasicFormatterImpl
:
Technology marches on. As noted by Alex, org.hibernate.pretty.Formatter
no longer exists as of version 3.3.2.GA. The replacement is org.hibernate.jdbc.util.BasicFormatterImpl
:
String formattedSQL = new BasicFormatterImpl().format(sql);
原始答案:
如果你正在使用Hibernate,他们有一个内置的: org.hibernate.pretty.Formatter
If you're using Hibernate, they've got one built-in: org.hibernate.pretty.Formatter
String formattedSQL = new Formatter(sql).format();
这篇关于寻找可嵌入的SQL美化器或重新格式化器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!