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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1f673c238a4d2ba62893cc40d1b9cba39ec670d89637dcbf414cc25d72ff796
4
- data.tar.gz: f08c8c2f290a5c66193ab8afa2c9e17095f801bb8d3793af09919e11f379c7e5
3
+ metadata.gz: 62f81b6f4b6195e663c823dbb1fda82a8a7530d534ed73a9ba27a048fdacb42d
4
+ data.tar.gz: c1af50b7c5421316290044ca548bd9983b568c8f6446402ba1d6b25ef46920ea
5
5
  SHA512:
6
- metadata.gz: e71435ffd85aea0165c31b32f38c685daa3f2057dbb2b123628eb5b54b077836f679c5792580277997321da7514c5ffcb0f3c7a567a75d20a91de65609dae5d7
7
- data.tar.gz: c309fa288ffdeb797c7807293846fb641e49ae9c3cdc043cdedf9acd7823bb2d66c831d1212a38c17fb9c5961f6210213a696d3f694729d216e826ee82ff9d8e
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
- first = line.strip.split(" ").first
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 @" and not %w[ON OFF].include? line.strip.split(" ").last
46
- wait = true
47
- set_lines << line
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)
@@ -94,7 +94,7 @@ module TSqlParser::Parsing
94
94
  next
95
95
  end
96
96
 
97
- if Parser.is_comment_start?(c, next_c)
97
+ if Parser.is_comment_start?(c, next_c) and not comment
98
98
  comment = true
99
99
  skip_count = 1
100
100
  specific_tokens << builder unless builder.empty?
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Stauffer