Skip to content

Fixed the output #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,31 @@ echo SqlFormatter::format($query);

Output:

![](http://jdorn.github.com/sql-formatter/format-highlight.png)
```sql

SELECT
count(*),
`Column1`,
`Testing`,
`Testing Three`
FROM
`Table1`
WHERE
Column1 = 'testing'
AND (
(
`Column2` = `Column3`
OR Column4 >= NOW()
)
)
GROUP BY
Column1
ORDER BY
Column3 DESC
LIMIT
5, 10

```

Formatting Only
-------------------------
Expand All @@ -55,7 +79,10 @@ echo SqlFormatter::format($query, false);

Output:

![](http://jdorn.github.com/sql-formatter/format.png)
```
SELECT count(*), `Column1`, `Testing`, `Testing Three` FROM `Table1` WHERE Column1 = 'testing' AND ( ( `Column2` = `Column3` OR Column4 >= NOW() ) ) GROUP BY Column1 ORDER BY Column3 DESC LIMIT 5, 10

```

Syntax Highlighting Only
-------------------------
Expand All @@ -73,7 +100,13 @@ echo SqlFormatter::highlight($query);

Output:

![](http://jdorn.github.com/sql-formatter/highlight.png)
```sql

SELECT count(*),`Column1`,`Testing`, `Testing Three` FROM `Table1`
WHERE Column1 = 'testing' AND ( (`Column2` = `Column3` OR Column4 >= NOW()) )
GROUP BY Column1 ORDER BY Column3 DESC LIMIT 5,10

```

Compress Query
--------------------------
Expand All @@ -97,8 +130,10 @@ echo SqlFormatter::compress($query)

Output:

```
```sql

SELECT Id as temp, DateCreated as Created FROM MyTable;

```

Remove Comments
Expand All @@ -121,7 +156,7 @@ echo SqlFormatter::removeComments($query);
```

Output:
```
```sql

SELECT

Expand Down