pg 1.5.1-x64-mingw-ucrt → 1.5.2-x64-mingw-ucrt

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: 1b1ebc1cc3f2e5922b20d9509fd0e49961dd3f0aa355746774e51a41e3fd41a3
4
- data.tar.gz: cc011f15818b0781342929eed7318c2e9c040dcd2ec08d4a25c2d9ccae6084fd
3
+ metadata.gz: 860e2bf9a722057b6b73f7c3cb72a33efc5dc592cf59b3317430e7bb080da281
4
+ data.tar.gz: c5937c718428eeda41763485b1a526443961047149220c78001118d22c45fd54
5
5
  SHA512:
6
- metadata.gz: 600fb50eb451429c95553f31478f60507c257897ef7b1aa53b720b701a60c92e77a5435e7039c312c2233e143aebe58273ca319f9c3697e4350ed5e327793878
7
- data.tar.gz: e6db05545558fb7876b637027d65ee5ead7542b526ed6dbb1b7f4b4a81a8f190e4850300bf85f89e72179b24405837f2337ea6d77e6994dac2a2d50d0c814e39
6
+ metadata.gz: 260bc87a40313f4c72f57bd875c310a04610cd45f4b4a81ef4bade0d83881682f254f36ddac7a5a69d0d084c79ba5f20847d61c1b4d6565335b49336d4aee9ac
7
+ data.tar.gz: 73ff82bfabe5f1ed4b7a8518fc00f5dd5e93fc4719e2af0441a6282562865b31799048e83383d10248792ed261a4622f6df1eeee487ff6e9e25b568497e53cf7
checksums.yaml.gz.sig CHANGED
Binary file
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)
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.2'
4
4
  end
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.2
5
5
  platform: x64-mingw-ucrt
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-26 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
Binary file