tsql_parser 0.0.1 → 0.0.2
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/text_formatter.rb +6 -0
- 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: b757cb7f1ee4f8b904d58f92dfe0c031a42e1c029c3fca2e9b9c276bc2c3954a
|
4
|
+
data.tar.gz: c0eb3a98483345e7a365800e400756c6bbdc7898d706f09f8759f17f044e0c06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca7f2b2f2c15d508bfddfa725ca8d979132c018e4b44fef321249329f55cc220cc8ca50b2dc2f414d17daf336ad97b6617ee6e28b5afde3a07f900f710e057cd
|
7
|
+
data.tar.gz: 46171055a31591de3ff362ebf14dc45bd819399ab3e5acffad9810499f9440f4da99eace839b1b775a966b8ea31982691fdad746597c345e2c6aca14a0229c85
|
@@ -157,6 +157,7 @@ module TSqlParser::Parsing
|
|
157
157
|
private
|
158
158
|
|
159
159
|
def self.format_set(s, tab_count = 0, tab = " ")
|
160
|
+
return s if s.nil?
|
160
161
|
parts = []
|
161
162
|
builder = ''
|
162
163
|
parenthesis = 0
|
@@ -179,6 +180,7 @@ module TSqlParser::Parsing
|
|
179
180
|
end
|
180
181
|
|
181
182
|
def self.format_update(s, tab_count = 0, tab = " ")
|
183
|
+
return s if s.nil?
|
182
184
|
formatted = []
|
183
185
|
parts = s.split(" SET ")
|
184
186
|
table = parts[0]
|
@@ -190,6 +192,7 @@ module TSqlParser::Parsing
|
|
190
192
|
end
|
191
193
|
|
192
194
|
def self.format_insert(s, tab_count = 0, tab = " ")
|
195
|
+
return s if s.nil?
|
193
196
|
formatted = []
|
194
197
|
if s.include? ") VALUES ("
|
195
198
|
tokens = s.split(") VALUES (")
|
@@ -205,11 +208,14 @@ module TSqlParser::Parsing
|
|
205
208
|
end
|
206
209
|
|
207
210
|
def self.format_select(s, tab_count = 0, tab = " ")
|
211
|
+
return s if s.nil?
|
212
|
+
|
208
213
|
tokens = s.split(", ")
|
209
214
|
"\n#{tokens.map { |t| "#{tab * (tab_count + 1)}#{t}" }.join(",\n")}"
|
210
215
|
end
|
211
216
|
|
212
217
|
def self.format_predicate(s, tab_count = 0, tab = " ")
|
218
|
+
return s if s.nil?
|
213
219
|
indented = []
|
214
220
|
formatted = []
|
215
221
|
builder = []
|