anbt-sql-formatter 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -1
- data/{readme.ja.txt → README.ja.rdoc} +2 -2
- data/{readme.txt → README.rdoc} +2 -2
- data/lib/anbt-sql-formatter/coarse-tokenizer.rb +3 -1
- data/lib/anbt-sql-formatter/version.rb +1 -1
- data/sample.sql +4 -0
- data/test.sh +10 -0
- data/test/test_parser.rb +30 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06d3d110d976d89ae531994e7a2e504028deb41c7e0576ad977445dd12a40e97
|
4
|
+
data.tar.gz: 07754a3a2b3169853345b4ead8f2290f0b4279bd913359b637c2e2d87994cb80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 760fa7076565da7636d4dd0659a7ac7f6651e61e50860b7b61cb1fdeac45a0d7836a0c3a3b832bc32b4eb8bcd939eff2e37135b0508822f028f72c4a5753ecd6
|
7
|
+
data.tar.gz: 3deda4f2457c216382e8c64d9343af513e60d762af57ab39f047a3b282756833ea7542b45d309375fa34f17ef4a5421ac57aee08c1c7439c94d6dcefed7c03cc
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,33 @@
|
|
1
|
+
# 0.1.0 (2018-12-16)
|
2
|
+
|
3
|
+
## Breaking changes
|
4
|
+
|
5
|
+
- Support `"{schema}"."{table}"` notation.
|
6
|
+
- Tokenize as a single name token. This affects formatter output:
|
7
|
+
|
8
|
+
```
|
9
|
+
echo 'select a from b.c, "d"."e"' | bin/anbt-sql-formatter
|
10
|
+
|
11
|
+
(before)
|
12
|
+
SELECT
|
13
|
+
a
|
14
|
+
FROM
|
15
|
+
b.c
|
16
|
+
,"d" . "e"
|
17
|
+
|
18
|
+
(after)
|
19
|
+
SELECT
|
20
|
+
a
|
21
|
+
FROM
|
22
|
+
b.c
|
23
|
+
,"d"."e"
|
24
|
+
```
|
25
|
+
|
1
26
|
# 0.0.7 (2018-08-11)
|
2
27
|
|
3
28
|
No breaking changes.
|
4
29
|
|
5
|
-
##
|
30
|
+
## Features
|
6
31
|
|
7
32
|
- New configuration parameter `Rule#in_values_num`
|
8
33
|
for controlling number of values in IN clause per line.
|
data/{readme.txt → README.rdoc}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
= anbt-sql-formatter
|
2
2
|
|
3
|
-
(C) 2010
|
3
|
+
(C) 2010-2018 sonota88 (yosiot8753@gmail.com)
|
4
4
|
|
5
5
|
|
6
6
|
== Description
|
@@ -55,4 +55,4 @@ Following are Authors of BlancoSqlFormatter(original Java version).
|
|
55
55
|
|
56
56
|
== Test
|
57
57
|
|
58
|
-
$
|
58
|
+
$ ./test.sh
|
@@ -64,7 +64,9 @@ These are exclusive:
|
|
64
64
|
## end double quote
|
65
65
|
|
66
66
|
length = $1.size
|
67
|
-
if /\A("")/ =~ str ##
|
67
|
+
if /\A(".")/ =~ str ## schema.table
|
68
|
+
shift_to_buf(3)
|
69
|
+
elsif /\A("")/ =~ str ## escaped double quote
|
68
70
|
shift_to_buf(2)
|
69
71
|
else
|
70
72
|
shift_token(length, :quote_double, :plain, :end)
|
data/sample.sql
CHANGED
data/test.sh
ADDED
data/test/test_parser.rb
CHANGED
@@ -303,6 +303,36 @@ class TestAnbtSqlParser < Test::Unit::TestCase
|
|
303
303
|
)))
|
304
304
|
)
|
305
305
|
|
306
|
+
########
|
307
|
+
assert_equals(
|
308
|
+
msg + "double-quoted schema and table",
|
309
|
+
strip_indent(
|
310
|
+
<<-EOB
|
311
|
+
name ("admin"."test")
|
312
|
+
EOB
|
313
|
+
),
|
314
|
+
_format( @parser.parse( strip_indent(
|
315
|
+
<<-EOB
|
316
|
+
"admin"."test"
|
317
|
+
EOB
|
318
|
+
)))
|
319
|
+
)
|
320
|
+
|
321
|
+
########
|
322
|
+
assert_equals(
|
323
|
+
msg + "minus + non-number",
|
324
|
+
strip_indent(
|
325
|
+
<<-EOB
|
326
|
+
name ("admin"."test")
|
327
|
+
EOB
|
328
|
+
),
|
329
|
+
_format( @parser.parse( strip_indent(
|
330
|
+
<<-EOB
|
331
|
+
"admin"."test"
|
332
|
+
EOB
|
333
|
+
)))
|
334
|
+
)
|
335
|
+
|
306
336
|
########
|
307
337
|
assert_equals(
|
308
338
|
msg + "minus + non-number",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anbt-sql-formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sonota88
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A tool for SQL formatting written in Ruby. Ruby port of Blanco SQL Formatter.
|
14
14
|
email:
|
@@ -21,6 +21,8 @@ files:
|
|
21
21
|
- ".gitignore"
|
22
22
|
- CHANGELOG.md
|
23
23
|
- Gemfile
|
24
|
+
- README.ja.rdoc
|
25
|
+
- README.rdoc
|
24
26
|
- Rakefile
|
25
27
|
- anbt-sql-formatter.gemspec
|
26
28
|
- bin/anbt-sql-formatter
|
@@ -37,10 +39,9 @@ files:
|
|
37
39
|
- lib/anbt-sql-formatter/version.rb
|
38
40
|
- misc/anbt-sql-formatter-customize-example
|
39
41
|
- misc/anbt-sql-formatter-for-sakura-editor.js
|
40
|
-
- readme.ja.txt
|
41
|
-
- readme.txt
|
42
42
|
- sample.sql
|
43
43
|
- setup.rb
|
44
|
+
- test.sh
|
44
45
|
- test/helper.rb
|
45
46
|
- test/test_coarse-tokenizer.rb
|
46
47
|
- test/test_formatter.rb
|