|
| 1 | +uroboroSQL Formatter |
| 2 | +==================== |
| 3 | + |
| 4 | +UroboroSQL Formatter is often used in enterprise systems, For formatting to a highly maintainable style even for very long SQL (1 K step or more) It is a plug-in of Sublime Text 3. |
| 5 | + |
| 6 | +In particular, in countries where English is not their mother tongue, such as Japan, comments may be included in SELECT clauses. In that case, we will align the vertical position of the AS clause and the comment, pursuing the viewability which can be said as artistic anymore, This was developed to realize this automatically. |
| 7 | + |
| 8 | +for Japanese, [Readme.ja.md](Readme.ja.md) |
| 9 | + |
| 10 | +#### In case of general formatter |
| 11 | + |
| 12 | +```SQL |
| 13 | +SELECT MI.MAKER_CD AS ITEM_MAKER_CD -- メーカーコード |
| 14 | +, |
| 15 | + MI.BRAND_CD AS ITEM_BRAND_CD -- ブランドコード |
| 16 | +, |
| 17 | + MI.ITEM_CD AS ITEM_CD -- 商品コード |
| 18 | +, |
| 19 | + MI.CATEGORY AS ITEM_CATEGORY -- 商品カテゴリ |
| 20 | +FROM M_ITEM MI -- 商品マスタ |
| 21 | + |
| 22 | +WHERE 1 = 1 |
| 23 | + AND MI.ARRIVAL_DATE = '2016-12-01' -- 入荷日 |
| 24 | +``` |
| 25 | + |
| 26 | +#### In case of uroboroSQL Formatter |
| 27 | + |
| 28 | +```SQL |
| 29 | +SELECT |
| 30 | + MI.MAKER_CD AS ITEM_MAKER_CD -- メーカーコード |
| 31 | +, MI.BRAND_CD AS ITEM_BRAND_CD -- ブランドコード |
| 32 | +, MI.ITEM_CD AS ITEM_CD -- 商品コード |
| 33 | +, MI.CATEGORY AS ITEM_CATEGORY -- 商品カテゴリ |
| 34 | +FROM |
| 35 | + M_ITEM MI -- 商品マスタ |
| 36 | +WHERE |
| 37 | + 1 = 1 |
| 38 | +AND MI.ARRIVAL_DATE = '2016-12-01' -- 入荷日 |
| 39 | + |
| 40 | +``` |
| 41 | + |
| 42 | +Features |
| 43 | +-------- |
| 44 | + |
| 45 | +- Formatting by aligning the vertical position of AS and operator in SELECT clause, WHERE clause |
| 46 | +- Even if there is a comment at the end of each line, the format |
| 47 | + |
| 48 | +How to Use |
| 49 | +---------- |
| 50 | + |
| 51 | +- Select "SQL Format" from the Edit menu |
| 52 | +- Select "SQL Format" from the context menu on the editor |
| 53 | +- Select "uroboroSQL Formatter: Format SQL" from the command Palette |
| 54 | + |
| 55 | +Settings |
| 56 | +-------- |
| 57 | + |
| 58 | +```json |
| 59 | +{ |
| 60 | + "uf_tab_size": 4, |
| 61 | + "uf_translate_tabs_to_spaces": false |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +- uf_tab_size |
| 66 | + - Specify the tab size of the indent after formatting. We recommend 4. |
| 67 | +- uf_translate_tabs_to_spaces |
| 68 | + - Specify whether the indent after formatting is tab or space. It becomes a space by setting it to true. |
| 69 | + |
| 70 | +License |
| 71 | +------- |
| 72 | + |
| 73 | +[python-sqlparse library](https://github.com/andialbrecht/sqlparse) and this code are both on [2-clauses BSD](http://www.opensource.org/licenses/bsd-license.php) |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +Copyright 2016 by Future Corporation. |
0 commit comments