pg 1.5.1-x64-mingw32 → 1.5.2-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: 965a62aeee6293e1d8b76d2b018024b31d2e540b83d8930bb480d521cc7598b1
4
+ data.tar.gz: a977824a52ab4844710e172b05290f47a6c8a49011eb8bb271a1af6703cdd87f
5
5
  SHA512:
6
- metadata.gz: 1a96e46a65198b64a52ca247027052c89d48c9cee2ecb7b01f3cf6372aaab991f69d7ed5ff8432929446c6578d02ae222ec5e59baf495ee6f5570180d8fad8fc
7
- data.tar.gz: 5aac315aad74eda7a64ccf2e0c2757009b56ff1c64637bbbd07cb4496755b7a9a7585072d1aad12725ef2e3fa59157bc1e604486a14eaa87dca05bdb5ad0f0da
6
+ metadata.gz: 3785d9a94845341b98b9ec0f2e72576057007b8e19512124f012b06ca717ef36064e8fae2c4e089e10e32f71be3cbe3bdc5b73fae8ad74b6481162db09923879
7
+ data.tar.gz: e68123f60f991a7fe108ce26992d5b1e32abf6eca0b125fb7a7230264b4ce981f12707dfd15cd3fba8ab4bd7747c8f443401df0f1e4c435e7ac87b4c29471080
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-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-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