pg 1.5.0 → 1.5.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.md +6 -0
- data/lib/pg/binary_decoder/timestamp.rb +3 -3
- data/lib/pg/binary_encoder/timestamp.rb +2 -2
- data/lib/pg/connection.rb +25 -4
- data/lib/pg/text_decoder/timestamp.rb +3 -3
- data/lib/pg/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 79eb5b70c2045456b11a407f31913f728593cb196090f7bc1e94f012e1e37070
         | 
| 4 | 
            +
              data.tar.gz: d6b9f0685a71e45482cb9c776fc8e092e7aa810d6a74364eb809f217a8cd09f1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8125aac41396b831d5a1986a80ceee2376c79ebc9ce5607c5739f7285ee0e4069dbd636b98ba51722b251f210c6295199bcd8589af7b77a9816a4156d190fa22
         | 
| 7 | 
            +
              data.tar.gz: feed68644345ae49bd4d1f2ce62571ea25ef8c8e7d032552096575a832b67595a84b18de09c6bdb9d007d3a845837ee9a6e031b746aa212d342580ab89bd793b
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/History.md
    CHANGED
    
    | @@ -1,3 +1,9 @@ | |
| 1 | 
            +
            ## v1.5.1 [2023-04-24] Lars Kanis <lars@greiz-reinsdorf.de>
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            - Don't overwrite flags of timestamp coders. [#524](https://github.com/ged/ruby-pg/pull/524)
         | 
| 4 | 
            +
              Fixes a regression in rails: https://github.com/rails/rails/issues/48049
         | 
| 5 | 
            +
             | 
| 6 | 
            +
             | 
| 1 7 | 
             
            ## v1.5.0 [2023-04-24] Lars Kanis <lars@greiz-reinsdorf.de>
         | 
| 2 8 |  | 
| 3 9 | 
             
            Enhancements:
         | 
| @@ -7,19 +7,19 @@ module PG | |
| 7 7 | 
             
            		class TimestampUtc < Timestamp
         | 
| 8 8 | 
             
            			def initialize(hash={}, **kwargs)
         | 
| 9 9 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 10 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC | 
| 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 15 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 16 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL | 
| 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 21 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 22 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL | 
| 22 | 
            +
            				super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
         | 
| 23 23 | 
             
            			end
         | 
| 24 24 | 
             
            		end
         | 
| 25 25 | 
             
            	end
         | 
| @@ -7,13 +7,13 @@ module PG | |
| 7 7 | 
             
            		class TimestampUtc < Timestamp
         | 
| 8 8 | 
             
            			def initialize(hash={}, **kwargs)
         | 
| 9 9 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 10 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_UTC | 
| 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 15 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 16 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_LOCAL | 
| 16 | 
            +
            				super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL)
         | 
| 17 17 | 
             
            			end
         | 
| 18 18 | 
             
            		end
         | 
| 19 19 | 
             
            	end
         | 
    
        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 | 
            -
            					#  | 
| 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)
         | 
| @@ -7,19 +7,19 @@ module PG | |
| 7 7 | 
             
            		class TimestampUtc < Timestamp
         | 
| 8 8 | 
             
            			def initialize(hash={}, **kwargs)
         | 
| 9 9 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 10 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC | 
| 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 15 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 16 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL | 
| 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 21 | 
             
            				warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
         | 
| 22 | 
            -
            				super(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL | 
| 22 | 
            +
            				super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
         | 
| 23 23 | 
             
            			end
         | 
| 24 24 | 
             
            		end
         | 
| 25 25 |  | 
    
        data/lib/pg/version.rb
    CHANGED
    
    
    
        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. | 
| 4 | 
            +
              version: 1.5.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 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- | 
| 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 |