sequel_pg 1.18.0 → 1.18.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
  SHA256:
3
- metadata.gz: 9d497c75bd5ace025a1696d5b5df76116dd54495afee2178872f8f19f06b9257
4
- data.tar.gz: 24a06481753cb39885de374dfca9e3adcc041e7b0c42550d3406513f79b41ba9
3
+ metadata.gz: 2662871f93e6779540dacacdcee37d0942f65c456ddd7d6d5c2587936a0f5903
4
+ data.tar.gz: 9b364ee075aabd1af37cd0980b5eb256c4cbefd8a473b4aead23203709896e12
5
5
  SHA512:
6
- metadata.gz: ddf3c461fd892e80c199f7f5f37cf65a46f14a6a41285e7eec0fdb6ec0da5d4cfa9c74a866f1d3f7da5d8ef1a967ca713da3b12f167b82c2ee0b53bafbcd1bf3
7
- data.tar.gz: c656f25a3ab3aa13286db0586d843b690c864fc219210de328edbca195b501c874046f96e098b8e3adcc549f11c052615c62ecec03f6821e6ebeab2dff6e874a
6
+ metadata.gz: 935750c355575ef4f7b5ccdfb87aa098e46c110bac13699175b7dbbd7eb292dfd4664f88f9cca3c795c0ba35a89fc5a44d57120fd1d9a4ad6ed13046c5c75bd6
7
+ data.tar.gz: b7b3eca0d8b4f938ed8678efec72c057e3208d9656964a44dbb4e9f68f28aeff1b5d3c2dfe7c94f9b5d63d5ccb852ef9016515c146c70457ec228291a3d0feb1
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.18.1 (2025-12-16)
2
+
3
+ * Fix truncated results for map/select_map/select_order_map/as_hash/to_hash_groups/select_hash/select_hash_groups/as_set/select_set for datasets using use_cursor (jeremyevans) (#62)
4
+
5
+ * Avoid compilation warnings checking for HAVE_* definitions (jeremyevans)
6
+
1
7
  === 1.18.0 (2025-12-01)
2
8
 
3
9
  * Optimize Dataset#all and #with_sql_all (jeremyevans)
@@ -1,4 +1,4 @@
1
- #define SEQUEL_PG_VERSION_INTEGER 11800
1
+ #define SEQUEL_PG_VERSION_INTEGER 11801
2
2
 
3
3
  #include <string.h>
4
4
  #include <stdio.h>
@@ -24,7 +24,7 @@
24
24
  #define RARRAY_AREF(a, i) (RARRAY_PTR(a)[i])
25
25
  #endif
26
26
 
27
- #if !HAVE_RB_HASH_NEW_CAPA
27
+ #ifndef HAVE_RB_HASH_NEW_CAPA
28
28
  #define rb_hash_new_capa(_) rb_hash_new()
29
29
  #endif
30
30
 
@@ -193,7 +193,7 @@ static ID spg_id_family;
193
193
  static ID spg_id_addr;
194
194
  static ID spg_id_mask_addr;
195
195
 
196
- #if HAVE_PQSETSINGLEROWMODE
196
+ #ifdef HAVE_PQSETSINGLEROWMODE
197
197
  static ID spg_id_get_result;
198
198
  static ID spg_id_clear;
199
199
  static ID spg_id_check;
@@ -1433,7 +1433,7 @@ static VALUE spg_yield_hash_rows_internal(VALUE self, PGresult *res, int enc_ind
1433
1433
  } else if (rb_type(pg_value) == T_ARRAY) {
1434
1434
  type = SPG_YIELD_COLUMNS_ARRAY;
1435
1435
  }
1436
- #if HAVE_RB_SET_NEW_CAPA
1436
+ #ifdef HAVE_RB_SET_NEW_CAPA
1437
1437
  } else if (pg_type == spg_sym_map_set) {
1438
1438
  if (SYMBOL_P(pg_value)) {
1439
1439
  type = SPG_YIELD_COLUMN_SET;
@@ -1449,7 +1449,7 @@ static VALUE spg_yield_hash_rows_internal(VALUE self, PGresult *res, int enc_ind
1449
1449
  type = SPG_YIELD_FIRST_ARRAY;
1450
1450
  } else if (pg_type == spg_sym_array_array) {
1451
1451
  type = SPG_YIELD_ARRAY_ARRAY;
1452
- #if HAVE_RB_SET_NEW_CAPA
1452
+ #ifdef HAVE_RB_SET_NEW_CAPA
1453
1453
  } else if (pg_type == spg_sym_first_set) {
1454
1454
  type = SPG_YIELD_FIRST_SET;
1455
1455
  } else if (pg_type == spg_sym_array_set) {
@@ -1542,7 +1542,7 @@ static VALUE spg_yield_hash_rows_internal(VALUE self, PGresult *res, int enc_ind
1542
1542
  rb_yield(ary);
1543
1543
  }
1544
1544
  break;
1545
- #if HAVE_RB_SET_NEW_CAPA
1545
+ #ifdef HAVE_RB_SET_NEW_CAPA
1546
1546
  case SPG_YIELD_COLUMN_SET:
1547
1547
  /* Set containing single column */
1548
1548
  {
@@ -1608,7 +1608,7 @@ static VALUE spg_yield_hash_rows_internal(VALUE self, PGresult *res, int enc_ind
1608
1608
  rb_yield(ary);
1609
1609
  }
1610
1610
  break;
1611
- #if HAVE_RB_SET_NEW_CAPA
1611
+ #ifdef HAVE_RB_SET_NEW_CAPA
1612
1612
  case SPG_YIELD_FIRST_SET:
1613
1613
  /* Array of first column */
1614
1614
  h = rb_set_new_capa(ntuples);
@@ -1837,14 +1837,14 @@ static VALUE spg_yield_hash_rows(VALUE self, VALUE rres, VALUE ignore) {
1837
1837
 
1838
1838
  static VALUE spg_supports_streaming_p(VALUE self) {
1839
1839
  return
1840
- #if HAVE_PQSETSINGLEROWMODE
1840
+ #ifdef HAVE_PQSETSINGLEROWMODE
1841
1841
  Qtrue;
1842
1842
  #else
1843
1843
  Qfalse;
1844
1844
  #endif
1845
1845
  }
1846
1846
 
1847
- #if HAVE_PQSETSINGLEROWMODE
1847
+ #ifdef HAVE_PQSETSINGLEROWMODE
1848
1848
  static VALUE spg_set_single_row_mode(VALUE self) {
1849
1849
  PGconn *conn;
1850
1850
  conn = pg_get_pgconn(self);
@@ -2193,7 +2193,7 @@ void Init_sequel_pg(void) {
2193
2193
 
2194
2194
  rb_define_singleton_method(spg_Postgres, "supports_streaming?", spg_supports_streaming_p, 0);
2195
2195
 
2196
- #if HAVE_PQSETSINGLEROWMODE
2196
+ #ifdef HAVE_PQSETSINGLEROWMODE
2197
2197
  spg_id_get_result = rb_intern("get_result");
2198
2198
  spg_id_clear = rb_intern("clear");
2199
2199
  spg_id_check = rb_intern("check");
@@ -26,12 +26,14 @@ class Sequel::Postgres::Dataset
26
26
  # :nocov:
27
27
  if RUBY_VERSION > '4'
28
28
  def as_set(column)
29
+ return super unless allow_sequel_pg_optimization?
29
30
  clone(:_sequel_pg_type=>:map_set, :_sequel_pg_value=>column).fetch_rows(sql){return it}
30
31
  Set.new
31
32
  end
32
33
  # :nocov:
33
34
  else
34
35
  def as_set(column)
36
+ return super unless allow_sequel_pg_optimization?
35
37
  rows = Set.new
36
38
  clone(:_sequel_pg_type=>:map, :_sequel_pg_value=>column).fetch_rows(sql){|s| rows.add(s)}
37
39
  rows
@@ -46,6 +48,7 @@ class Sequel::Postgres::Dataset
46
48
  if block_given?
47
49
  super
48
50
  else
51
+ return super unless allow_sequel_pg_optimization?
49
52
  clone(:_sequel_pg_type=>:map_array, :_sequel_pg_value=>sym).fetch_rows(sql){|a| return a}
50
53
  []
51
54
  end
@@ -62,6 +65,7 @@ class Sequel::Postgres::Dataset
62
65
  # In the case where both arguments given, use an optimized version.
63
66
  def as_hash(key_column, value_column = nil, opts = Sequel::OPTS)
64
67
  if value_column && !opts[:hash]
68
+ return super unless allow_sequel_pg_optimization?
65
69
  clone(:_sequel_pg_type=>:hash, :_sequel_pg_value=>[key_column, value_column]).fetch_rows(sql){|s| return s}
66
70
  {}
67
71
  elsif opts.empty?
@@ -82,6 +86,7 @@ class Sequel::Postgres::Dataset
82
86
  # In the case where both arguments given, use an optimized version.
83
87
  def to_hash_groups(key_column, value_column = nil, opts = Sequel::OPTS)
84
88
  if value_column && !opts[:hash]
89
+ return super unless allow_sequel_pg_optimization?
85
90
  clone(:_sequel_pg_type=>:hash_groups, :_sequel_pg_value=>[key_column, value_column]).fetch_rows(sql){|s| return s}
86
91
  {}
87
92
  elsif opts.empty?
@@ -118,12 +123,14 @@ class Sequel::Postgres::Dataset
118
123
 
119
124
  # Always use optimized version
120
125
  def _select_map_multiple(ret_cols)
126
+ return super unless allow_sequel_pg_optimization?
121
127
  clone(:_sequel_pg_type=>:array_array).fetch_rows(sql){|a| return a}
122
128
  []
123
129
  end
124
130
 
125
131
  # Always use optimized version
126
132
  def _select_map_single
133
+ return super unless allow_sequel_pg_optimization?
127
134
  clone(:_sequel_pg_type=>:first_array).fetch_rows(sql){|a| return a}
128
135
  []
129
136
  end
@@ -134,12 +141,14 @@ class Sequel::Postgres::Dataset
134
141
  if RUBY_VERSION > '4'
135
142
  # Always use optimized version
136
143
  def _select_set_multiple(ret_cols)
144
+ return super unless allow_sequel_pg_optimization?
137
145
  clone(:_sequel_pg_type=>:array_set).fetch_rows(sql){return it}
138
146
  Set.new
139
147
  end
140
148
 
141
149
  # Always use optimized version
142
150
  def _select_set_single
151
+ return super unless allow_sequel_pg_optimization?
143
152
  clone(:_sequel_pg_type=>:first_set).fetch_rows(sql){return it}
144
153
  Set.new
145
154
  end
@@ -147,6 +156,7 @@ class Sequel::Postgres::Dataset
147
156
  else
148
157
  # Always use optimized version
149
158
  def _select_set_multiple(ret_cols)
159
+ return super unless allow_sequel_pg_optimization?
150
160
  set = Set.new
151
161
  clone(:_sequel_pg_type=>:array).fetch_rows(sql){|s| set.add s}
152
162
  set
@@ -154,6 +164,7 @@ class Sequel::Postgres::Dataset
154
164
 
155
165
  # Always use optimized version
156
166
  def _select_set_single
167
+ return super unless allow_sequel_pg_optimization?
157
168
  set = Set.new
158
169
  clone(:_sequel_pg_type=>:first).fetch_rows(sql){|s| set.add s}
159
170
  set
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans