diff --git a/bin/sql-formatter b/bin/sql-formatter index c96c79b..cc8c7b1 100755 --- a/bin/sql-formatter +++ b/bin/sql-formatter @@ -37,4 +37,14 @@ function hasColorSupport() { $highlight = hasColorSupport(); -echo SqlFormatter::format($sql, $highlight); +$queries = SqlFormatter::splitQuery($sql); +$i = 1; +$multipleQueries = count($queries) > 1; +foreach ($queries as $query) { + if ($multipleQueries) { + echo PHP_EOL; + echo '== Query #' . $i . ' ==' . PHP_EOL; + } + echo SqlFormatter::format($query, $highlight); + $i++; +}