summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md30
1 files changed, 28 insertions, 2 deletions
diff --git a/README.md b/README.md
index d9a9942..a144323 100644
--- a/README.md
+++ b/README.md
@@ -75,10 +75,36 @@ Output:
![](http://jdorn.github.com/sql-formatter/highlight.png)
+Compress Query
+--------------------------
+
+The compress method removes all comments and compresses whitespace.
+
+This is useful for outputting queries that can be copy pasted to the command line easily.
+
+```
+-- This is a comment
+ SELECT
+ /* This is another comment
+ On more than one line */
+ Id #This is one final comment
+ as temp, DateCreated as Created FROM MyTable;
+```
+
+```php
+echo SqlFormatter::compress($query)
+```
+
+Output:
+
+```
+SELECT Id as temp, DateCreated as Created FROM MyTable;
+```
+
Remove Comments
------------------------
-
-There is a removeComments method that, you guessed it, removes all comments from a query.
+If you want to keep all original whitespace formatting and just remove comments,
+you can use the removeComments method instead of compress.
```
-- This is a comment