tsql_parser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parsing/formatters/strategy/set_formatter.rb +14 -4
- data/lib/parsing/tokenizer.rb +1 -1
- 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: 62f81b6f4b6195e663c823dbb1fda82a8a7530d534ed73a9ba27a048fdacb42d
|
4
|
+
data.tar.gz: c1af50b7c5421316290044ca548bd9983b568c8f6446402ba1d6b25ef46920ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24c95e57e20af4b3dff6d7b15cb38e0736bddc683f025c9bc5300e6662992045e110990343497c13952524de2868fdc5341214ab744d6305416a2f001388d555
|
7
|
+
data.tar.gz: 06d257666a82067a42990e8c0f9a4ac8dd1644ec399f7f8aa453cfe7d2465dc680a349c7623bcf92e6f1f0d412a6a4ea2440f818bdf1b239510896b601e891cd
|
@@ -23,8 +23,13 @@ module TSqlParser::Parsing::Formatters
|
|
23
23
|
lines = text.split("\n")
|
24
24
|
wait = false
|
25
25
|
set_lines = []
|
26
|
+
special_set_keywords = %w[ANSI_DEFAULTS ANSI_NULL_DFLT_OFF ANSI_NULL_DFLT_ON ANSI_NULLS ANSI_PADDING ANSI_WARNINGS ARITHABORT ARITHIGNORE CONCAT_NULL_YIELDS_NULL CURSOR_CLOSE_ON_COMMIT DATEFIRST DATEFORMAT DEADLOCK_PRIORITY FIPS_FLAGGER FMTONLY FORCEPLAN IDENTITY_INSERT IMPLICIT_TRANSACTIONS LANGUAGE LOCK_TIMEOUT NOCOUNT NOEXEC NUMERIC_ROUNDABORT OFFSETS PARSEONLY QUERY_GOVERNOR_COST_LIMIT QUOTED_IDENTIFIER REMOTE_PROC_TRANSACTIONS ROWCOUNT SHOWPLAN_ALL SHOWPLAN_TEXT SHOWPLAN_XML STATISTICS TEXTSIZE TRANSACTION XACT_ABORT]
|
27
|
+
|
26
28
|
lines.each do |line|
|
27
|
-
|
29
|
+
tokens = line.strip.split(" ")
|
30
|
+
first = tokens.first
|
31
|
+
next_token = tokens[1] if tokens.size > 1
|
32
|
+
|
28
33
|
if %w[FROM WHERE].include? first and wait
|
29
34
|
wait = false
|
30
35
|
tab_count = self.get_tab_count(line, tab)
|
@@ -42,9 +47,14 @@ module TSqlParser::Parsing::Formatters
|
|
42
47
|
next
|
43
48
|
end
|
44
49
|
|
45
|
-
if first == "SET" and not line.strip.start_with? "SET @"
|
46
|
-
|
47
|
-
|
50
|
+
if first == "SET" and not line.strip.start_with? "SET @"
|
51
|
+
if not next_token.nil? and not special_set_keywords.include? next_token
|
52
|
+
wait = true
|
53
|
+
set_lines << line
|
54
|
+
else
|
55
|
+
formatted << line
|
56
|
+
formatted << ""
|
57
|
+
end
|
48
58
|
elsif first != "SET" and line.include? " SET "
|
49
59
|
parts = line.strip.split(" SET ")
|
50
60
|
tab_count = self.get_tab_count(line, tab)
|
data/lib/parsing/tokenizer.rb
CHANGED