tsql_parser 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parsing/formatter.rb +10 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e2633fba3d6e5113119872e1fad4618da4a7f404436e2e5d86137ae82516db3
4
- data.tar.gz: a27d777e1a54c8eba9803158b121d7c74b39ca004d4d0e49b242194f9095e125
3
+ metadata.gz: a0a85b6dba179ecd613d8c18923b25c14ea4ae1b7a06f0ddba09eb212c21502b
4
+ data.tar.gz: dbc151c034be90b2837d133b3c87e4fe476585b0108f9afd382f01a0471d4259
5
5
  SHA512:
6
- metadata.gz: 71667cfc1e258bcf400ce64af5a5f49747eec77e4fa4399444bc7f2b41e1757a2dc920b7273564fbf7b430928299bbf5f2a06074c6ed5e786baae44774051e2b
7
- data.tar.gz: 7dc006e6d915670337661dd6829e95942984d48d6ddc28ebfc3ae6332a348337fbd629fa50da81882ac2a717e9a9bf9c17507b93b8db69bb4a26ed7e2ba9094c
6
+ metadata.gz: f77f801453284b9a941b2d1f8ca22718e6783a3b733181c697f0f6ff09bfc0373afdc50b39ea7915006c16c81b0b60b2641dd0926ecd13df5800c6a65a6a9a4f
7
+ data.tar.gz: eaf630332538b7cf7fa6d677d400882a1f7f194c95882f1f630fbbb59e3d3b902f3bc8708eecd792e1d8f51489c79831298d4673589a2d6583ceea975bf3b038
@@ -78,13 +78,21 @@ module TSqlParser::Parsing
78
78
  next_line = work_lines[index + 1] unless index + 1 > work_lines.size
79
79
  next_line_first = next_line.strip.split(" ").first unless next_line.nil?
80
80
 
81
+ if first.nil?
82
+ #tab_count -= 1 if tab_count > 0
83
+ next
84
+ end
85
+
81
86
  if Parser.is_label? first
82
87
  indented_lines << "#{tab * tab_count}#{line}"
83
- tab_count += 1
88
+ #tab_count += 1
84
89
  elsif %w[CASE BEGIN SELECT].include? first or line.strip.start_with? "CREATE PROCEDURE"
85
90
  indented_lines << "#{tab * tab_count}#{line}"
86
91
  tab_count += 1
87
- elsif %w[FROM END GO].include? first and not %w[DELETE UPDATE INSERT SET].include? last
92
+ elsif %w[FROM GO].include? first and not %w[DELETE UPDATE INSERT FROM FETCH].include? last
93
+ tab_count -= 1 if tab_count > 0
94
+ indented_lines << "#{tab * tab_count}#{line}"
95
+ elsif %w[END END;].include? first
88
96
  tab_count -= 1 if tab_count > 0
89
97
  indented_lines << "#{tab * tab_count}#{line}"
90
98
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsql_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Stauffer