pretty print sql query

Does someone have pretty_print function for print SQL query in java?

given string like:

SELECT person_table.name FROM person_table JOIN person_person ON person_table.name=person_person WHERE person_table.name=dan

The function will print:

SELECT person_table.name

FROM person_table

JOIN person_person

ON person_table.name=person_person

WHERE person_table.name=dan

or better?

Thanks in advance!


你可以看看org.apache.openjpa.lib.jdbc.SQLFormatter。


如果你使用Hibernate,试试org.hibernate.jdbc.util.FormatStyle.BASIC.getFormatter().format(yourNonFormattedSqlQueryString);

链接地址: http://www.djcxy.com/p/12146.html

上一篇: URI,URL和URN的例子

下一篇: 漂亮的打印sql查询