tsql_parser 0.0.9 → 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/lib/parsing/formatter.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0a85b6dba179ecd613d8c18923b25c14ea4ae1b7a06f0ddba09eb212c21502b
|
4
|
+
data.tar.gz: dbc151c034be90b2837d133b3c87e4fe476585b0108f9afd382f01a0471d4259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f77f801453284b9a941b2d1f8ca22718e6783a3b733181c697f0f6ff09bfc0373afdc50b39ea7915006c16c81b0b60b2641dd0926ecd13df5800c6a65a6a9a4f
|
7
|
+
data.tar.gz: eaf630332538b7cf7fa6d677d400882a1f7f194c95882f1f630fbbb59e3d3b902f3bc8708eecd792e1d8f51489c79831298d4673589a2d6583ceea975bf3b038
|
data/lib/parsing/formatter.rb
CHANGED
@@ -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
|
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
|