sql-formatter icon indicating copy to clipboard operation
sql-formatter copied to clipboard

Add support for streaming

Open greg0ire opened this issue 4 years ago • 2 comments

See https://github.com/jdorn/sql-formatter/issues/68

greg0ire avatar Apr 11 '20 09:04 greg0ire

This seems possible now thanks to https://github.com/doctrine/sql-formatter/pull/48

goetas avatar Apr 28 '20 17:04 goetas

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).

mvorisek avatar Jun 04 '24 11:06 mvorisek