Skip to content

Commit bf0e77f

Browse files
author
Kenichi Hoshi
committed
initial commit
0 parents  commit bf0e77f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+16159
-0
lines changed

Context.sublime-menu

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"id": "uroborosql-formatter",
4+
"caption": "SQL Format",
5+
"command": "uroborosql_format"
6+
}
7+
]

Default.sublime-commands

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"caption": "uroboroSQL Formatter: Format SQL",
4+
"command": "uroborosql_format"
5+
}
6+
]

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2016, Future Corporation
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Main.sublime-menu

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[{
2+
"caption": "Edit",
3+
"mnemonic": "E",
4+
"id": "edit",
5+
"children": [{
6+
"caption": "-"
7+
}, {
8+
"command": "uroborosql_format",
9+
"id": "uroborosql_format",
10+
"caption": "SQL Format"
11+
}]
12+
}, {
13+
"caption": "Preferences",
14+
"mnemonic": "n",
15+
"id": "preferences",
16+
"children": [{
17+
"caption": "Package Settings",
18+
"mnemonic": "P",
19+
"id": "package-settings",
20+
"children": [{
21+
"caption": "uroboroSQL Formatter",
22+
"children": [{
23+
"command": "open_file",
24+
"args": {
25+
"file": "${packages}/sublime-uroborosql-formatter/Preferences.sublime-settings"
26+
},
27+
"caption": "Settings – Default"
28+
}, {
29+
"command": "open_file",
30+
"args": {
31+
"file": "${packages}/User/sublime-uroborosql-formatter.sublime-settings"
32+
},
33+
"caption": "Settings – User"
34+
}]
35+
}]
36+
}]
37+
}]

Preferences.sublime-settings

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"uf_tab_size": 4,
3+
"uf_translate_tabs_to_spaces": true
4+
}

Readme.ja.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
uroboroSQL Formatter
2+
====================
3+
4+
uroboroSQL Formatterは、エンタープライズシステムで用いられることの多い、
5+
非常に長いSQL(1K step以上)でも見やすく保守性の高いスタイルへフォーマットするための
6+
Sublime Text 3のプラグインです。
7+
8+
特に日本など、英語を母国語としない国では、SELECT句などにコメントを入れることがあります。
9+
その場合、AS句とコメントの縦位置を揃えて、もはや芸術的とも言える見やすさを追求しますが、
10+
これ自動的に実現するために開発したものです。
11+
12+
#### 一般的なフォーマッタの場合
13+
14+
```SQL
15+
SELECT MI.MAKER_CD AS ITEM_MAKER_CD -- メーカーコード
16+
,
17+
MI.BRAND_CD AS ITEM_BRAND_CD -- ブランドコード
18+
,
19+
MI.ITEM_CD AS ITEM_CD -- 商品コード
20+
,
21+
MI.CATEGORY AS ITEM_CATEGORY -- 商品カテゴリ
22+
FROM M_ITEM MI -- 商品マスタ
23+
24+
WHERE 1 = 1
25+
AND MI.ARRIVAL_DATE = '2016-12-01' -- 入荷日
26+
```
27+
28+
#### uroboroSQL Formatterの場合
29+
30+
```SQL
31+
SELECT
32+
MI.MAKER_CD AS ITEM_MAKER_CD -- メーカーコード
33+
, MI.BRAND_CD AS ITEM_BRAND_CD -- ブランドコード
34+
, MI.ITEM_CD AS ITEM_CD -- 商品コード
35+
, MI.CATEGORY AS ITEM_CATEGORY -- 商品カテゴリ
36+
FROM
37+
M_ITEM MI -- 商品マスタ
38+
WHERE
39+
1 = 1
40+
AND MI.ARRIVAL_DATE = '2016-12-01' -- 入荷日
41+
42+
```
43+
44+
Features
45+
--------
46+
47+
- SELECT句、WHERE句内でASや演算子の縦位置を揃えてフォーマット
48+
- 各行の末尾にコメントがあっても正しくフォーマット
49+
50+
How to Use
51+
----------
52+
53+
- Editメニューから「SQL Format」を選択
54+
- エディタ上のコンテキストメニューから「SQL Format」を選択
55+
- コマンドPaletteから「uroboroSQL Formatter: Format SQL」を選択
56+
57+
Settings
58+
--------
59+
60+
```json
61+
{
62+
"uf_tab_size": 4,
63+
"uf_translate_tabs_to_spaces": false
64+
}
65+
```
66+
67+
- uf_tab_size
68+
- フォーマット後のインデントのタブサイズを指定します。4つを推奨します。
69+
- uf_translate_tabs_to_spaces
70+
- フォーマット後のインデントをタブにするかスペースにするかを指定します。trueにすることでスペースになります。
71+
72+
License
73+
-------
74+
75+
[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)
76+
77+
---
78+
79+
Copyright 2016 by Future Corporation.

Readme.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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.

enum/LICENSE

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Copyright (c) 2013, Ethan Furman.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
8+
Redistributions of source code must retain the above
9+
copyright notice, this list of conditions and the
10+
following disclaimer.
11+
12+
Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials
15+
provided with the distribution.
16+
17+
Neither the name Ethan Furman nor the names of any
18+
contributors may be used to endorse or promote products
19+
derived from this software without specific prior written
20+
permission.
21+
22+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
POSSIBILITY OF SUCH DAMAGE.

enum/README

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
enum34 is the new Python stdlib enum module available in Python 3.4
2+
backported for previous versions of Python from 2.4 to 3.3.
3+
tested on 2.6, 2.7, and 3.3+

0 commit comments

Comments
 (0)