doctrine/sql-formatter

Add support for streaming

Opened this issue · 2 comments

This seems possible now thanks to #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 jdorn/sql-formatter#68, tokenization can be streamed on token basic and formatting done on query basic with separating detected using these two conditions

if ($indentLevel === 0) {
$prevNotWhitespaceToken = $cursor->subCursor()->previous(Token::TOKEN_TYPE_WHITESPACE);
if ($prevNotWhitespaceToken !== null && $prevNotWhitespaceToken->value() === ';') {
(semicolon + zero indentation level).