pg_query 0.11.0 → 0.11.1

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: 80111a507d64911a62b77017e55feb80a4dad56b
4
- data.tar.gz: 06887ee5734b6290a5763b942ba1dde1b21fc1b2
3
+ metadata.gz: e699cba04d1b278f58c368193c6c43a2ebf17506
4
+ data.tar.gz: 8459ffee76d0577784347996c87ba3ecbe5fcc42
5
5
  SHA512:
6
- metadata.gz: cb42f31b99f44ccf66df76cb43d9e82f40a2cd87f5dce4d41d392d4920d00ba4c5d240cb25f7550988e1715e2ccd91dcedc5be8787d0cbc305a3412bd7d9a1c9
7
- data.tar.gz: bd6c058613222acb36071f847d04afbaba2dbee6c685d52aa914fba1c12e0e86561ea226c75890f16193134426f3ee484d2a984a6fa1a3f9f9183b1db17134de
6
+ metadata.gz: 9c264389fef9ebba3d4582e17e827aaabc320de78cfd07d020872af3b5a7e60cc681788cc20928f2386a045be0fed75788608fc922cbe75fbbb1c63fe5d16398
7
+ data.tar.gz: 580d6c662de265e1bfa55b08704c044ce45434e145b2b95985146ab4be6835c962bcb48b813d74eea8dc4e965b2ead91b29fe5e6e978f86acefd3245f30b00d8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1 2016-06-26
4
+
5
+ * Updated fingerprinting logic to version 1.1
6
+ * Fixes an issue with UpdateStmt target lists being ignored
7
+ * Update to newest libpg_query version (9.5-1.4.0)
8
+
9
+
3
10
  ## 0.11.0 2016-06-22
4
11
 
5
12
  * Improved table name analysis (#tables method)
@@ -3,7 +3,7 @@
3
3
  require 'mkmf'
4
4
  require 'open-uri'
5
5
 
6
- LIB_PG_QUERY_TAG = '9.5-1.3.0'
6
+ LIB_PG_QUERY_TAG = '9.5-1.4.0'
7
7
 
8
8
  workdir = Dir.pwd
9
9
  libdir = File.join(workdir, 'libpg_query-' + LIB_PG_QUERY_TAG)
@@ -33,26 +33,26 @@ class PgQuery
33
33
  [nil, 0, false, [], ''].include?(val)
34
34
  end
35
35
 
36
- def fingerprint_value(val, hash, field_name, need_to_write_name)
36
+ def fingerprint_value(val, hash, parent_node_name, parent_field_name, need_to_write_name)
37
37
  return if ignored_fingerprint_value?(val)
38
38
 
39
39
  subhash = FingerprintSubHash.new
40
40
 
41
41
  if val.is_a?(Hash)
42
- fingerprint_node(val, subhash, field_name)
42
+ fingerprint_node(val, subhash, parent_node_name, parent_field_name)
43
43
  elsif val.is_a?(Array)
44
- fingerprint_list(val, subhash, field_name)
44
+ fingerprint_list(val, subhash, parent_node_name, parent_field_name)
45
45
  else
46
46
  subhash.update val.to_s
47
47
  end
48
48
 
49
49
  return if subhash.parts.empty?
50
50
 
51
- hash.update(field_name) if need_to_write_name
51
+ hash.update(parent_field_name) if need_to_write_name
52
52
  subhash.flush_to(hash)
53
53
  end
54
54
 
55
- def fingerprint_node(node, hash, parent_field_name = nil) # rubocop:disable Metrics/CyclomaticComplexity
55
+ def fingerprint_node(node, hash, parent_node_name = nil, parent_field_name = nil) # rubocop:disable Metrics/CyclomaticComplexity
56
56
  node_name = node.keys.first
57
57
  return if [A_CONST, ALIAS, PARAM_REF, SET_TO_DEFAULT, INT_LIST, OID_LIST, NULL].include?(node_name)
58
58
 
@@ -65,7 +65,7 @@ class PgQuery
65
65
  when 'location'
66
66
  next
67
67
  when 'name'
68
- next if node_name == RES_TARGET && parent_field_name == TARGET_LIST_FIELD
68
+ next if node_name == RES_TARGET && parent_node_name == SELECT_STMT && parent_field_name == TARGET_LIST_FIELD
69
69
  next if [PREPARE_STMT, EXECUTE_STMT, DEALLOCATE_STMT].include?(node_name)
70
70
  when 'gid'
71
71
  next if node_name == TRANSACTION_STMT
@@ -73,15 +73,15 @@ class PgQuery
73
73
  next if node_name == TRANSACTION_STMT
74
74
  end
75
75
 
76
- fingerprint_value(val, hash, field_name, true)
76
+ fingerprint_value(val, hash, node_name, field_name, true)
77
77
  end
78
78
  end
79
79
 
80
- def fingerprint_list(values, hash, parent_field_name)
80
+ def fingerprint_list(values, hash, parent_node_name, parent_field_name)
81
81
  if [FROM_CLAUSE_FIELD, TARGET_LIST_FIELD, COLS_FIELD, REXPR_FIELD].include?(parent_field_name)
82
82
  values_subhashes = values.map do |val|
83
83
  subhash = FingerprintSubHash.new
84
- fingerprint_value(val, subhash, parent_field_name, false)
84
+ fingerprint_value(val, subhash, parent_node_name, parent_field_name, false)
85
85
  subhash
86
86
  end
87
87
 
@@ -93,7 +93,7 @@ class PgQuery
93
93
  end
94
94
  else
95
95
  values.each do |val|
96
- fingerprint_value(val, hash, parent_field_name, false)
96
+ fingerprint_value(val, hash, parent_node_name, parent_field_name, false)
97
97
  end
98
98
  end
99
99
  end
@@ -1,3 +1,3 @@
1
1
  class PgQuery
2
- VERSION = '0.11.0'
2
+ VERSION = '0.11.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Fittl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler