jdorn / sql-formatter

A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.
http://jdorn.github.com/sql-formatter/
MIT License
3.89k stars 187 forks source link

CASE WHEN dont have a line break #83

Open morphiaz opened 8 years ago

morphiaz commented 8 years ago

having something like this:

CASE WHEN ... WHEN ... WHEN ... THEN ...

is not creating a line break after each WHEN command. right now its beiing displayed like this:

CASE WHEN ... WHEN ... WHEN ... THEN ...

With a lot of CASEs, this is getting difficult.

JannemanDev commented 5 years ago

To be more precise, syntax is a bit different: https://www.techonthenet.com/oracle/functions/case.php
https://www.techonthenet.com/sql_server/functions/case.php
https://www.techonthenet.com/mysql/functions/case.php

For example:

SELECT plantname,
       CASE price
         WHEN 1 THEN 'Cheap'
         WHEN 2 THEN 'Expensive'
         ELSE 'Unknown'
       END
FROM plant