sql-formatter
sql-formatter copied to clipboard
Add support for streaming
See https://github.com/jdorn/sql-formatter/issues/68
This seems possible now thanks to https://github.com/doctrine/sql-formatter/pull/48
Tokens can be streamed, but formatting cannot as we might need up too complete lookbehind/lookahead.
However, if you want to support piping as requested in https://github.com/jdorn/sql-formatter/issues/68, tokenization can be streamed on token basic and formatting done on query basic with separating detected using these two conditions https://github.com/doctrine/sql-formatter/blob/027ca226b9408b08c9f7c79b16c0368ef65e6d01/src/SqlFormatter.php#L120-L122 (semicolon + zero indentation level).