Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPretty print for Statement #286
Comments
It could easily implemented if you overwrite the methods from the deparsers. |
@jesperpedersen, on a side note, did you know about the Poor Man's SQL Formatter? |
Pull requests are wellcome. As I mentioned the deparsers modifications should be easy. |
An alternative to implementing this in JSqlParser will be to use Hibernate's implementation for SQL formatting. If you already have a dependency on the relevant libraries, just call: |
Just implemented this: https://github.com/vertical-blank/sql-formatter Extremely simple and effective. |
I couldn't figure out the dependency. I tried |
@stewartbryson, I didn't try to import it directly from hibernate actually, as I needed to apply a few small changes to the hibernate formatter, so we just copied the source code of the file to our codebase, from: Once I had that class, I can just import the class BasicFormatterImpl and call: |
it would be great if Statement had a
method, which formats the resulting String into a maximum width.
It would make it much nicer to display to end-users.
Or something similar, like
with predefined line breaks.