anbt-sql-formatter 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4680b59adee7c6d2e6bcb649d73b095d3bbcd3d102f8517d50acefc89dfe089
4
- data.tar.gz: dac35873e1d94941ec19156d2738fe75c1b0e156e2357cc1a10e263157c253c6
3
+ metadata.gz: 06d3d110d976d89ae531994e7a2e504028deb41c7e0576ad977445dd12a40e97
4
+ data.tar.gz: 07754a3a2b3169853345b4ead8f2290f0b4279bd913359b637c2e2d87994cb80
5
5
  SHA512:
6
- metadata.gz: 52692fbb602a719f52a13077bd72b7a4c8d065ba484c6fbd141f928ad3987364dd3517c6fd7d66f9283acee8ecf8fd7033d2df467ffe6a5e0aa4f9e401b7cc6d
7
- data.tar.gz: dcc161a7b754fd3937dfa8c799950aba2ea88a1db9990f38fb4e51ff6cb69e6c07ce619bd4843dba358e93f31d3787ba231ca076fbbdcd0216b224628f802b18
6
+ metadata.gz: 760fa7076565da7636d4dd0659a7ac7f6651e61e50860b7b61cb1fdeac45a0d7836a0c3a3b832bc32b4eb8bcd939eff2e37135b0508822f028f72c4a5753ecd6
7
+ data.tar.gz: 3deda4f2457c216382e8c64d9343af513e60d762af57ab39f047a3b282756833ea7542b45d309375fa34f17ef4a5421ac57aee08c1c7439c94d6dcefed7c03cc
@@ -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
- ## Feattues
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.
@@ -1,6 +1,6 @@
1
1
  = anbt-sql-formatter
2
2
 
3
- (C) 2010 sonota <yosiot8753@gmail.com>
3
+ (C) 2010-2018 sonota88 <yosiot8753@gmail.com>
4
4
 
5
5
 
6
6
  == 概要
@@ -95,7 +95,7 @@ sonota:: Ruby へ移植
95
95
 
96
96
  == テスト
97
97
 
98
- $ ruby setup.rb test
98
+ $ ./test.sh
99
99
 
100
100
 
101
101
  == その他
@@ -1,6 +1,6 @@
1
1
  = anbt-sql-formatter
2
2
 
3
- (C) 2010 sonota (yosiot8753@gmail.com)
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
- $ ruby setup.rb test
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 ## escaped double quote
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)
@@ -1,7 +1,7 @@
1
1
  module Anbt
2
2
  module Sql
3
3
  module Formatter
4
- VERSION = "0.0.7"
4
+ VERSION = "0.1.0"
5
5
  end
6
6
  end
7
7
  end
data/sample.sql CHANGED
@@ -118,3 +118,7 @@ foobar(a)
118
118
  foobar(a,b)
119
119
  ;
120
120
 
121
+ --------------------------------
122
+ -- {schema}.{table}, {table}.{column}
123
+ select t1.a, `t2`.`b`, "t3"."c"
124
+ from schema.t1, `schema`.`t2`, "schema"."t3"
data/test.sh ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+
3
+ set -o errexit
4
+
5
+ (
6
+ cd test
7
+ for file in $(ls test_*.rb); do
8
+ ruby $file
9
+ done
10
+ )
@@ -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.7
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: 2018-08-11 00:00:00.000000000 Z
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