piggly 2.2.2 → 2.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7b807efe5c5d12d4a91d3be46379b423094471e
4
- data.tar.gz: 733371c4f0c66f954ed0992b2084b48795fa4f61
3
+ metadata.gz: a2b78c278ad31f77e5dbf4677a77e42f6a24a267
4
+ data.tar.gz: c9a87f1bca511331450caf12f26d48bd165d8744
5
5
  SHA512:
6
- metadata.gz: 6d545575f7e1a105b61be250cf8dcfd48748792d473e9737036265979449159a4c5f1f1d5862426c9da8508e2bfb127e545db52a4d1a85203edb2bc76dfdfdcb
7
- data.tar.gz: ee79b0de1bce8668ad3e0354d2d132a7bc6d1a8f29446efa16c5a60b96a39a3257634d7b93dfb3823313f2595d036529c881480fa2d226ebc8f5887ce1a33f3c
6
+ metadata.gz: 796cd9e88a976fd7fd5365f6a123168e254b4acf41a70c7de338cdf5f96c46c5d21fa0a51c3fb54a67d08089712a45eafedc1b776fea2dd289a4efb61b45dad4
7
+ data.tar.gz: 99fe5b35d5e9dc01c923b0f30cdc79a0ac4628b6be6883bb68cf5fb1e06b0b73d3fe4381c938f0f83d402352df4a36e6c07b851866c0e578e45037c1f2c93323
@@ -234,7 +234,7 @@ grammar Piggly
234
234
  body:(kwRETURN ( tSpace? &';'
235
235
  / tSpace kwNEXT tSpace expressionUntilSemiColon tSpace?
236
236
  / tSpace kwQUERY tSpace expressionUntilSemiColon
237
- / expressionUntilSemiColon )) ';'
237
+ / expressionUntilSemiColon )) ';' <Piggly::Parser::Nodes::Return>
238
238
  end
239
239
 
240
240
  rule stmtRaise
@@ -256,7 +256,7 @@ grammar Piggly
256
256
  end
257
257
 
258
258
  rule stmtGetDiag
259
- kwGET tSpace kwSTACKED tSpace kwDIAGNOSTICS tSpace expressionUntilSemiColon ';' <Piggly::Parser::Nodes::Expression>
259
+ kwGET tSpace ( kwSTACKED tSpace )? kwDIAGNOSTICS tSpace expressionUntilSemiColon ';' <Piggly::Parser::Nodes::Expression>
260
260
  end
261
261
 
262
262
  rule stmtNull
@@ -169,7 +169,7 @@ sorttable = {
169
169
  for (var i=0; i<table.tBodies[0].rows.length; i++) {
170
170
  text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
171
171
  if (text != '') {
172
- if (text.match(/^-?[�$�]?[\d,.]+%?$/)) {
172
+ if (text.match(/^-?[$]?[\d,.]+%?$/)) {
173
173
  return sorttable.sort_numeric;
174
174
  }
175
175
  // check for a date: dd/mm/yyyy or dd/mm/yy
@@ -2,7 +2,7 @@ module Piggly
2
2
  module VERSION
3
3
  MAJOR = 2
4
4
  MINOR = 2
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  RELEASE_DATE = "2017-10-23"
8
8
  end
@@ -4,14 +4,14 @@ module Piggly
4
4
  describe "github issue #28" do
5
5
  include GrammarHelper
6
6
 
7
- it "can parse the a GET DIAGNOSTICS expression" do
7
+ it "can parse a GET STACKED DIAGNOSTICS statement" do
8
8
  body = 'GET STACKED DIAGNOSTICS text_var1 = MESSAGE_TEXT, text_var2 = PG_EXCEPTION_DETAIL, text_var3 = PG_EXCEPTION_HINT;'
9
9
 
10
10
  node = parse(:statement, body)
11
11
  node.should be_statement
12
12
  end
13
13
 
14
- it "can parse a procedure with GET DIAGNOSTICS" do
14
+ it "can parse a procedure with GET STACKED DIAGNOSTICS" do
15
15
  body = <<-SQL
16
16
  DECLARE
17
17
  text_var1 text;
@@ -0,0 +1,41 @@
1
+ require "spec_helper"
2
+
3
+ module Piggly
4
+ describe "github issue #32" do
5
+ include GrammarHelper
6
+
7
+ it "can parse a GET DIAGNOSTICS statement" do
8
+ node = parse(:statement, "GET DIAGNOSTICS v_cnt = ROw_COUNT;")
9
+ node.should be_statement
10
+ end
11
+
12
+ it "can parse a procedure with GET DIAGNOSTICS" do
13
+ body = <<-SQL
14
+ DECLARE
15
+ v_cnt INTEGER;
16
+ BEGIN
17
+ INSERT INTO foo.foo_table(bar, barbar_fl, foofoo_fl, bazbaz_ts)
18
+ SELECT
19
+ a.zoorzoor_id,
20
+ b.zap_fl,
21
+ b.zip_fl,
22
+ current_timestamp
23
+ FROM unnest(p_baz) a
24
+ INNER JOIN foo.zimzam b
25
+ ON a.zoor_id = b.zoor_id
26
+ ON CONFLICT (bar)
27
+ DO UPDATE SET barbar_fl= excluded.barbar_fl, foofoo_fl= excluded.foofoo_fl, last_updt_ts=current_timestamp;
28
+ GET DIAGNOSTICS v_cnt = ROW_COUNT;
29
+ RAISE NOTICE Updated % bar stuffs', v_cnt;
30
+ RETURN v_cnt;
31
+ END;
32
+ SQL
33
+
34
+ node = parse(:start, body.strip.downcase)
35
+ node.count{|e| e.sql? }.should == 1
36
+ node.count{|e| Parser::Nodes::Raise === e }.should == 1
37
+ node.count{|e| Parser::Nodes::Return === e }.should == 1
38
+ end
39
+
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kvle Putnam
@@ -136,6 +136,7 @@ files:
136
136
  - spec/issues/018_spec.rb
137
137
  - spec/issues/028_spec.rb
138
138
  - spec/issues/032_spec.rb
139
+ - spec/issues/036_spec.rb
139
140
  - spec/spec_helper.rb
140
141
  - spec/spec_suite.rb
141
142
  homepage: http://github.com/kputnam/piggly