File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1515use PhpMyAdmin \SqlParser \Translator ;
1616
1717use function array_slice ;
18+ use function implode ;
1819use function preg_match ;
1920
2021/**
@@ -269,25 +270,18 @@ public function parse(Parser $parser, TokensList $list): void
269270
270271 public function build (): string
271272 {
272- $ initial = true ;
273- $ str = 'WITH ' ;
273+ $ str = 'WITH ' ;
274274
275275 if ($ this ->options !== null && $ this ->options ->options !== []) {
276- $ str .= ' ' . $ this ->options ->build ();
276+ $ str .= $ this ->options ->build () . ' ' ;
277277 }
278278
279- foreach ($ this ->withers as $ wither ) {
280- $ str .= $ initial ? ' ' : ', ' ;
281- $ str .= $ wither ->build ();
282- $ initial = false ;
279+ if ($ this ->withers !== []) {
280+ $ str .= implode (', ' , $ this ->withers ) . ' ' ;
283281 }
284282
285- $ str .= ' ' ;
286-
287283 if ($ this ->cteStatementParser ) {
288- foreach ($ this ->cteStatementParser ->statements as $ statement ) {
289- $ str .= $ statement ->build ();
290- }
284+ $ str .= implode ('' , $ this ->cteStatementParser ->statements );
291285 }
292286
293287 return $ str ;
You can’t perform that action at this time.
0 commit comments