pg 1.5.1-x64-mingw32 → 1.5.3-x64-mingw32

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: efaa722b4b1eeac8cec2b19810a76b38e760410e1d035f7eb68e42e818b6c346
4
- data.tar.gz: 1668007d3e4c7775f17d37228dd05b45439771631313ded0bf0c85653c9ed296
3
+ metadata.gz: 446a14cb9e82644f39143b72b3a8fe6c9df919835709b69139e972013f322ec5
4
+ data.tar.gz: 664d953714bb1be9c2903b97fbcda29a53994dc1b4aca43b87e1092f8d172352
5
5
  SHA512:
6
- metadata.gz: 1a96e46a65198b64a52ca247027052c89d48c9cee2ecb7b01f3cf6372aaab991f69d7ed5ff8432929446c6578d02ae222ec5e59baf495ee6f5570180d8fad8fc
7
- data.tar.gz: 5aac315aad74eda7a64ccf2e0c2757009b56ff1c64637bbbd07cb4496755b7a9a7585072d1aad12725ef2e3fa59157bc1e604486a14eaa87dca05bdb5ad0f0da
6
+ metadata.gz: 289df9bd183104621ea395b11e9bf6a763ce31f23b79a7c7487eb1d4892a35bf8c5874ec3f75a42264ab220941852fe58c98fc5c6a3d3e65efd21c8be1412b0d
7
+ data.tar.gz: 503810c481b089a40ad7db1636ebb8f5b0bda6e67ef4c31ed360b649b8412e53076d20ddc1cdce9470726e362b255c9aa280524ac58c94996905db334cd4c3f6
checksums.yaml.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## v1.5.3 [2023-04-28] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ - Fix possible segfault when creating a new PG::Result with type map. [#530](https://github.com/ged/ruby-pg/pull/530)
4
+ - Add category to deprecation warnings of Coder.new, so that they are suppressed for most users. [#528](https://github.com/ged/ruby-pg/pull/528)
5
+
6
+
7
+ ## v1.5.2 [2023-04-26] Lars Kanis <lars@greiz-reinsdorf.de>
8
+
9
+ - Fix regression in copy_data regarding binary format when using no coder. [#527](https://github.com/ged/ruby-pg/pull/527)
10
+
11
+
1
12
  ## v1.5.1 [2023-04-24] Lars Kanis <lars@greiz-reinsdorf.de>
2
13
 
3
14
  - Don't overwrite flags of timestamp coders. [#524](https://github.com/ged/ruby-pg/pull/524)
data/ext/pg_result.c CHANGED
@@ -208,12 +208,16 @@ pg_new_result2(PGresult *result, VALUE rb_pgconn)
208
208
 
209
209
  this = (t_pg_result *)xmalloc(sizeof(*this) + sizeof(*this->fnames) * nfields);
210
210
  this->pgresult = result;
211
+ /* Initialize connection and typemap prior to any object allocations,
212
+ * to make sure valid objects are marked. */
213
+ this->connection = rb_pgconn;
214
+ this->typemap = pg_typemap_all_strings;
215
+ this->p_typemap = RTYPEDDATA_DATA( this->typemap );
211
216
  this->nfields = -1;
212
217
  this->tuple_hash = Qnil;
213
218
  this->field_map = Qnil;
214
219
  this->flags = 0;
215
220
  self = TypedData_Wrap_Struct(rb_cPGresult, &pgresult_type, this);
216
- RB_OBJ_WRITE(self, &this->connection, rb_pgconn);
217
221
 
218
222
  if( result ){
219
223
  t_pg_connection *p_conn = pg_get_connection(rb_pgconn);
@@ -227,8 +231,6 @@ pg_new_result2(PGresult *result, VALUE rb_pgconn)
227
231
  this->p_typemap = RTYPEDDATA_DATA( this->typemap );
228
232
  this->flags = p_conn->flags;
229
233
  } else {
230
- RB_OBJ_WRITE(self, &this->typemap, pg_typemap_all_strings);
231
- this->p_typemap = RTYPEDDATA_DATA( this->typemap );
232
234
  this->enc_idx = rb_locale_encindex();
233
235
  }
234
236
 
@@ -391,7 +393,7 @@ pg_result_clear(VALUE self)
391
393
  *
392
394
  */
393
395
  VALUE
394
- pg_result_freeze(VALUE self)
396
+ static pg_result_freeze(VALUE self)
395
397
  {
396
398
  t_pg_result *this = pgresult_get_this(self);
397
399
 
@@ -405,7 +407,7 @@ pg_result_freeze(VALUE self)
405
407
  *
406
408
  * Returns +true+ if the backend result memory has been freed.
407
409
  */
408
- VALUE
410
+ static VALUE
409
411
  pgresult_cleared_p( VALUE self )
410
412
  {
411
413
  t_pg_result *this = pgresult_get_this(self);
@@ -422,7 +424,7 @@ pgresult_cleared_p( VALUE self )
422
424
  * All other Result objects are automatically cleared by the GC when the object is no longer in use or manually by PG::Result#clear .
423
425
  *
424
426
  */
425
- VALUE
427
+ static VALUE
426
428
  pgresult_autoclear_p( VALUE self )
427
429
  {
428
430
  t_pg_result *this = pgresult_get_this(self);
@@ -1422,8 +1424,9 @@ pgresult_type_map_set(VALUE self, VALUE typemap)
1422
1424
  /* Check type of method param */
1423
1425
  TypedData_Get_Struct(typemap, t_typemap, &pg_typemap_type, p_typemap);
1424
1426
 
1425
- RB_OBJ_WRITE(self, &this->typemap, p_typemap->funcs.fit_to_result( typemap, self ));
1426
- this->p_typemap = RTYPEDDATA_DATA( this->typemap );
1427
+ typemap = p_typemap->funcs.fit_to_result( typemap, self );
1428
+ RB_OBJ_WRITE(self, &this->typemap, typemap);
1429
+ this->p_typemap = RTYPEDDATA_DATA( typemap );
1427
1430
 
1428
1431
  return typemap;
1429
1432
  }
@@ -287,9 +287,7 @@ pg_tmbc_init(VALUE self, VALUE conv_ary)
287
287
  t_pg_coder *p_coder;
288
288
  /* Check argument type and store the coder pointer */
289
289
  TypedData_Get_Struct(obj, t_pg_coder, &pg_coder_type, p_coder);
290
- if( p_coder ){
291
- RB_OBJ_WRITTEN(self, Qnil, p_coder->coder_obj);
292
- }
290
+ RB_OBJ_WRITTEN(self, Qnil, p_coder->coder_obj);
293
291
  this->convs[i].cconv = p_coder;
294
292
  }
295
293
  }
data/lib/2.5/pg_ext.so CHANGED
Binary file
data/lib/2.6/pg_ext.so CHANGED
Binary file
data/lib/2.7/pg_ext.so CHANGED
Binary file
data/lib/3.0/pg_ext.so CHANGED
Binary file
@@ -6,19 +6,19 @@ module PG
6
6
  # Convenience classes for timezone options
7
7
  class TimestampUtc < Timestamp
8
8
  def initialize(hash={}, **kwargs)
9
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
9
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
10
10
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC)
11
11
  end
12
12
  end
13
13
  class TimestampUtcToLocal < Timestamp
14
14
  def initialize(hash={}, **kwargs)
15
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
15
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
16
16
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
17
17
  end
18
18
  end
19
19
  class TimestampLocal < Timestamp
20
20
  def initialize(hash={}, **kwargs)
21
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
21
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
22
22
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
23
23
  end
24
24
  end
@@ -6,13 +6,13 @@ module PG
6
6
  # Convenience classes for timezone options
7
7
  class TimestampUtc < Timestamp
8
8
  def initialize(hash={}, **kwargs)
9
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
9
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
10
10
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC)
11
11
  end
12
12
  end
13
13
  class TimestampLocal < Timestamp
14
14
  def initialize(hash={}, **kwargs)
15
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
15
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
16
16
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL)
17
17
  end
18
18
  end
data/lib/pg/coder.rb CHANGED
@@ -7,7 +7,7 @@ module PG
7
7
 
8
8
  module BinaryFormatting
9
9
  def initialize(hash={}, **kwargs)
10
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
10
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
11
11
  super(format: 1, **hash, **kwargs)
12
12
  end
13
13
  end
@@ -15,7 +15,7 @@ module PG
15
15
 
16
16
  # Create a new coder object based on the attribute Hash.
17
17
  def initialize(hash=nil, **kwargs)
18
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" if hash
18
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) if hash
19
19
 
20
20
  (hash || kwargs).each do |key, val|
21
21
  send("#{key}=", val)
data/lib/pg/connection.rb CHANGED
@@ -166,6 +166,14 @@ class PG::Connection
166
166
  # conn.put_copy_data ['more', 'data', 'to', 'copy']
167
167
  # end
168
168
  #
169
+ # Also PG::BinaryEncoder::CopyRow can be used to send data in binary format to the server.
170
+ # In this case copy_data generates the header and trailer data automatically:
171
+ # enco = PG::BinaryEncoder::CopyRow.new
172
+ # conn.copy_data "COPY my_table FROM STDIN (FORMAT binary)", enco do
173
+ # conn.put_copy_data ['some', 'data', 'to', 'copy']
174
+ # conn.put_copy_data ['more', 'data', 'to', 'copy']
175
+ # end
176
+ #
169
177
  # Example with CSV output format:
170
178
  # conn.copy_data "COPY my_table TO STDOUT CSV" do
171
179
  # while row=conn.get_copy_data
@@ -187,6 +195,18 @@ class PG::Connection
187
195
  # This receives all rows of +my_table+ as ruby array:
188
196
  # ["some", "data", "to", "copy"]
189
197
  # ["more", "data", "to", "copy"]
198
+ #
199
+ # Also PG::BinaryDecoder::CopyRow can be used to retrieve data in binary format from the server.
200
+ # In this case the header and trailer data is processed by the decoder and the remaining +nil+ from get_copy_data is processed by copy_data, so that binary data can be processed equally to text data:
201
+ # deco = PG::BinaryDecoder::CopyRow.new
202
+ # conn.copy_data "COPY my_table TO STDOUT (FORMAT binary)", deco do
203
+ # while row=conn.get_copy_data
204
+ # p row
205
+ # end
206
+ # end
207
+ # This receives all rows of +my_table+ as ruby array:
208
+ # ["some", "data", "to", "copy"]
209
+ # ["more", "data", "to", "copy"]
190
210
 
191
211
  def copy_data( sql, coder=nil )
192
212
  raise PG::NotInBlockingMode.new("copy_data can not be used in nonblocking mode", connection: self) if nonblocking?
@@ -195,7 +215,7 @@ class PG::Connection
195
215
  case res.result_status
196
216
  when PGRES_COPY_IN
197
217
  begin
198
- if res.binary_tuples == 1
218
+ if coder && res.binary_tuples == 1
199
219
  # Binary file header (11 byte signature, 32 bit flags and 32 bit extension length)
200
220
  put_copy_data(BinarySignature + ("\x00" * 8))
201
221
  end
@@ -219,7 +239,7 @@ class PG::Connection
219
239
  begin
220
240
  self.encoder_for_put_copy_data = old_coder if coder
221
241
 
222
- if res.binary_tuples == 1
242
+ if coder && res.binary_tuples == 1
223
243
  put_copy_data("\xFF\xFF") # Binary file trailer 16 bit "-1"
224
244
  end
225
245
 
@@ -244,8 +264,9 @@ class PG::Connection
244
264
  discard_results
245
265
  raise
246
266
  else
247
- if res.binary_tuples == 1
248
- # there are two end markers in binary mode: file trailer and the final nil
267
+ if coder && res.binary_tuples == 1
268
+ # There are two end markers in binary mode: file trailer and the final nil.
269
+ # The file trailer is expected to be processed by BinaryDecoder::CopyRow and already returns nil, so that the remaining NULL from PQgetCopyData is retrieved here:
249
270
  if get_copy_data
250
271
  discard_results
251
272
  raise PG::NotAllCopyDataRetrieved.new("Not all binary COPY data retrieved", connection: self)
@@ -6,19 +6,19 @@ module PG
6
6
  # Convenience classes for timezone options
7
7
  class TimestampUtc < Timestamp
8
8
  def initialize(hash={}, **kwargs)
9
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
9
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
10
10
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC)
11
11
  end
12
12
  end
13
13
  class TimestampUtcToLocal < Timestamp
14
14
  def initialize(hash={}, **kwargs)
15
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
15
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
16
16
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
17
17
  end
18
18
  end
19
19
  class TimestampLocal < Timestamp
20
20
  def initialize(hash={}, **kwargs)
21
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
21
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
22
22
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
23
23
  end
24
24
  end
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.5.1'
3
+ VERSION = '1.5.3'
4
4
  end
data/lib/pg.rb CHANGED
@@ -115,4 +115,15 @@ module PG
115
115
  require 'pg/tuple'
116
116
  autoload :VERSION, 'pg/version'
117
117
 
118
+
119
+ # Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1
120
+ if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations)
121
+ module TruffleFixWarn
122
+ def warn(str, category=nil)
123
+ super(str)
124
+ end
125
+ end
126
+ Warning.extend(TruffleFixWarn)
127
+ end
128
+
118
129
  end # module PG
Binary file
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.3
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Michael Granger
@@ -34,7 +34,7 @@ cert_chain:
34
34
  Dzx/gFSOrRoCt2mXNgrmcAfr386AfaMvCh7cXqdxZwmVo7ILZCYXck0pajvubsDd
35
35
  NUIIFkVXvd1odFyK9LF1RFAtxn/iAmpx
36
36
  -----END CERTIFICATE-----
37
- date: 2023-04-24 00:00:00.000000000 Z
37
+ date: 2023-04-28 00:00:00.000000000 Z
38
38
  dependencies: []
39
39
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
40
40
  9.3 and later.
metadata.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- 0c,f)��^�V���`r���#ΰWZL�����9��VJě2#�h
2
- P>T6e%@�|R�Qn0I�e����uҶ��.u_���`1Jm�1]i��7j�e([1t\��&pu
1
+ '��9?������'Uy�v��nS8*k?� ���5[�zZ[tC�?��׵�4g3��
2
+ Q>d/���)9j��,��q���%|v_�!�_g�;wn]���sAOWA"V�e�$
3
+ ����x^�-7��V���e�•�:a]�Q}� �+�'xު.����Թ��jS��j�m^�Md��$F]�|����A�1t�nd����+T�z�i`)��O���(�G)��H���\h5U�N����@$v1m=C�������i���v =4I�g��������:������\�nn,@�:�Ľj�~�GV� ��: �VN�DӾ ��/G��x��>j���o���q#c�|��1��E�~��t
4
+ :_���. 2���nR*΄L