pg 1.4.1 → 1.5.6

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.appveyor.yml +15 -9
  4. data/.github/workflows/binary-gems.yml +45 -14
  5. data/.github/workflows/source-gem.yml +35 -23
  6. data/.gitignore +11 -2
  7. data/.travis.yml +2 -2
  8. data/Gemfile +3 -0
  9. data/{History.rdoc → History.md} +285 -140
  10. data/README.ja.md +300 -0
  11. data/README.md +286 -0
  12. data/Rakefile +18 -6
  13. data/Rakefile.cross +8 -11
  14. data/certs/kanis@comcard.de.pem +20 -0
  15. data/certs/larskanis-2023.pem +24 -0
  16. data/certs/larskanis-2024.pem +24 -0
  17. data/ext/errorcodes.def +4 -0
  18. data/ext/errorcodes.txt +2 -1
  19. data/ext/extconf.rb +4 -0
  20. data/ext/pg.c +15 -55
  21. data/ext/pg.h +11 -6
  22. data/ext/pg_binary_decoder.c +80 -1
  23. data/ext/pg_binary_encoder.c +225 -1
  24. data/ext/pg_coder.c +17 -8
  25. data/ext/pg_connection.c +201 -73
  26. data/ext/pg_copy_coder.c +307 -18
  27. data/ext/pg_errors.c +1 -1
  28. data/ext/pg_record_coder.c +6 -5
  29. data/ext/pg_result.c +102 -26
  30. data/ext/pg_text_decoder.c +28 -10
  31. data/ext/pg_text_encoder.c +23 -10
  32. data/ext/pg_tuple.c +35 -32
  33. data/ext/pg_type_map.c +4 -3
  34. data/ext/pg_type_map_all_strings.c +3 -3
  35. data/ext/pg_type_map_by_class.c +6 -4
  36. data/ext/pg_type_map_by_column.c +9 -5
  37. data/ext/pg_type_map_by_mri_type.c +1 -1
  38. data/ext/pg_type_map_by_oid.c +8 -5
  39. data/ext/pg_type_map_in_ruby.c +6 -3
  40. data/lib/pg/basic_type_map_based_on_result.rb +21 -1
  41. data/lib/pg/basic_type_map_for_queries.rb +19 -10
  42. data/lib/pg/basic_type_map_for_results.rb +26 -3
  43. data/lib/pg/basic_type_registry.rb +35 -33
  44. data/lib/pg/binary_decoder/date.rb +9 -0
  45. data/lib/pg/binary_decoder/timestamp.rb +26 -0
  46. data/lib/pg/binary_encoder/timestamp.rb +20 -0
  47. data/lib/pg/coder.rb +15 -13
  48. data/lib/pg/connection.rb +186 -104
  49. data/lib/pg/exceptions.rb +7 -0
  50. data/lib/pg/text_decoder/date.rb +18 -0
  51. data/lib/pg/text_decoder/inet.rb +9 -0
  52. data/lib/pg/text_decoder/json.rb +14 -0
  53. data/lib/pg/text_decoder/numeric.rb +9 -0
  54. data/lib/pg/text_decoder/timestamp.rb +30 -0
  55. data/lib/pg/text_encoder/date.rb +12 -0
  56. data/lib/pg/text_encoder/inet.rb +28 -0
  57. data/lib/pg/text_encoder/json.rb +14 -0
  58. data/lib/pg/text_encoder/numeric.rb +9 -0
  59. data/lib/pg/text_encoder/timestamp.rb +24 -0
  60. data/lib/pg/version.rb +1 -1
  61. data/lib/pg.rb +55 -15
  62. data/pg.gemspec +5 -3
  63. data/rakelib/task_extension.rb +1 -1
  64. data.tar.gz.sig +0 -0
  65. metadata +96 -32
  66. metadata.gz.sig +0 -0
  67. data/README.ja.rdoc +0 -13
  68. data/README.rdoc +0 -214
  69. data/lib/pg/binary_decoder.rb +0 -23
  70. data/lib/pg/constants.rb +0 -12
  71. data/lib/pg/text_decoder.rb +0 -46
  72. data/lib/pg/text_encoder.rb +0 -59
@@ -0,0 +1,28 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ require 'ipaddr'
5
+
6
+ module PG
7
+ module TextEncoder
8
+ class Inet < SimpleEncoder
9
+ def encode(value)
10
+ case value
11
+ when IPAddr
12
+ default_prefix = (value.family == Socket::AF_INET ? 32 : 128)
13
+ s = value.to_s
14
+ if value.respond_to?(:prefix)
15
+ prefix = value.prefix
16
+ else
17
+ range = value.to_range
18
+ prefix = default_prefix - Math.log(((range.end.to_i - range.begin.to_i) + 1), 2).to_i
19
+ end
20
+ s << "/" << prefix.to_s if prefix != default_prefix
21
+ s
22
+ else
23
+ value
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end # module PG
@@ -0,0 +1,14 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ require 'json'
5
+
6
+ module PG
7
+ module TextEncoder
8
+ class JSON < SimpleEncoder
9
+ def encode(value)
10
+ ::JSON.generate(value, quirks_mode: true)
11
+ end
12
+ end
13
+ end
14
+ end # module PG
@@ -0,0 +1,9 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ module PG
5
+ module TextEncoder
6
+ # Init C part of the decoder
7
+ init_numeric
8
+ end
9
+ end # module PG
@@ -0,0 +1,24 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ module PG
5
+ module TextEncoder
6
+ class TimestampWithoutTimeZone < SimpleEncoder
7
+ def encode(value)
8
+ value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N") : value
9
+ end
10
+ end
11
+
12
+ class TimestampUtc < SimpleEncoder
13
+ def encode(value)
14
+ value.respond_to?(:utc) ? value.utc.strftime("%Y-%m-%d %H:%M:%S.%N") : value
15
+ end
16
+ end
17
+
18
+ class TimestampWithTimeZone < SimpleEncoder
19
+ def encode(value)
20
+ value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N %:z") : value
21
+ end
22
+ end
23
+ end
24
+ end # module PG
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.4.1'
3
+ VERSION = '1.5.6'
4
4
  end
data/lib/pg.rb CHANGED
@@ -50,12 +50,6 @@ module PG
50
50
  end
51
51
  end
52
52
 
53
-
54
- class NotAllCopyDataRetrieved < PG::Error
55
- end
56
- class NotInBlockingMode < PG::Error
57
- end
58
-
59
53
  # Get the PG library version.
60
54
  #
61
55
  # +include_buildnum+ is no longer used and any value passed will be ignored.
@@ -69,21 +63,67 @@ module PG
69
63
  Connection.new( *args, &block )
70
64
  end
71
65
 
66
+ if defined?(Ractor.make_shareable)
67
+ def self.make_shareable(obj)
68
+ Ractor.make_shareable(obj)
69
+ end
70
+ else
71
+ def self.make_shareable(obj)
72
+ obj.freeze
73
+ end
74
+ end
75
+
76
+ module BinaryDecoder
77
+ %i[ TimestampUtc TimestampUtcToLocal TimestampLocal ].each do |klass|
78
+ autoload klass, 'pg/binary_decoder/timestamp'
79
+ end
80
+ autoload :Date, 'pg/binary_decoder/date'
81
+ end
82
+ module BinaryEncoder
83
+ %i[ TimestampUtc TimestampLocal ].each do |klass|
84
+ autoload klass, 'pg/binary_encoder/timestamp'
85
+ end
86
+ end
87
+ module TextDecoder
88
+ %i[ TimestampUtc TimestampUtcToLocal TimestampLocal TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
89
+ autoload klass, 'pg/text_decoder/timestamp'
90
+ end
91
+ autoload :Date, 'pg/text_decoder/date'
92
+ autoload :Inet, 'pg/text_decoder/inet'
93
+ autoload :JSON, 'pg/text_decoder/json'
94
+ autoload :Numeric, 'pg/text_decoder/numeric'
95
+ end
96
+ module TextEncoder
97
+ %i[ TimestampUtc TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
98
+ autoload klass, 'pg/text_encoder/timestamp'
99
+ end
100
+ autoload :Date, 'pg/text_encoder/date'
101
+ autoload :Inet, 'pg/text_encoder/inet'
102
+ autoload :JSON, 'pg/text_encoder/json'
103
+ autoload :Numeric, 'pg/text_encoder/numeric'
104
+ end
72
105
 
106
+ autoload :BasicTypeMapBasedOnResult, 'pg/basic_type_map_based_on_result'
107
+ autoload :BasicTypeMapForQueries, 'pg/basic_type_map_for_queries'
108
+ autoload :BasicTypeMapForResults, 'pg/basic_type_map_for_results'
109
+ autoload :BasicTypeRegistry, 'pg/basic_type_registry'
73
110
  require 'pg/exceptions'
74
- require 'pg/constants'
75
111
  require 'pg/coder'
76
- require 'pg/binary_decoder'
77
- require 'pg/text_encoder'
78
- require 'pg/text_decoder'
79
- require 'pg/basic_type_registry'
80
- require 'pg/basic_type_map_based_on_result'
81
- require 'pg/basic_type_map_for_queries'
82
- require 'pg/basic_type_map_for_results'
83
112
  require 'pg/type_map_by_column'
84
113
  require 'pg/connection'
85
114
  require 'pg/result'
86
115
  require 'pg/tuple'
87
- require 'pg/version'
116
+ autoload :VERSION, 'pg/version'
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
88
128
 
89
129
  end # module PG
data/pg.gemspec CHANGED
@@ -17,16 +17,18 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/ged/ruby-pg"
20
- spec.metadata["changelog_uri"] = "https://github.com/ged/ruby-pg/blob/master/History.rdoc"
20
+ spec.metadata["changelog_uri"] = "https://github.com/ged/ruby-pg/blob/master/History.md"
21
21
  spec.metadata["documentation_uri"] = "http://deveiate.org/code/pg"
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
25
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|translation)/}) }
27
27
  end
28
28
  spec.extensions = ["ext/extconf.rb"]
29
29
  spec.require_paths = ["lib"]
30
30
  spec.cert_chain = ["certs/ged.pem"]
31
- spec.rdoc_options = ["--main", "README.rdoc"]
31
+ spec.rdoc_options = ["--main", "README.md",
32
+ "--title", "PG: The Ruby PostgreSQL Driver"]
33
+ spec.extra_rdoc_files = `git ls-files -z *.rdoc *.md lib/*.rb lib/*/*.rb lib/*/*/*.rb ext/*.c ext/*.h`.split("\x0")
32
34
  end
@@ -9,7 +9,7 @@ module TaskExtension
9
9
  def file(name, *args, &block)
10
10
  task_once(name, block) do
11
11
  super(name, *args) do |ta|
12
- block.call(ta).tap do
12
+ block&.call(ta).tap do
13
13
  raise "file #{ta.name} is missing after task executed" unless File.exist?(ta.name)
14
14
  end
15
15
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,19 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
8
8
  - Lars Kanis
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
11
  - |
13
12
  -----BEGIN CERTIFICATE-----
14
- MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
15
- L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yMjAyMTQxMzMwNTZaFw0yMzAy
16
- MTQxMzMwNTZaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
13
+ MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
14
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNDAyMjgxOTMxNDdaFw0yNTAy
15
+ MjcxOTMxNDdaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
17
16
  PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
18
17
  mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
19
18
  eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
@@ -22,21 +21,19 @@ cert_chain:
22
21
  JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
23
22
  eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhNexUtbjk6P8emmXOJi5
24
23
  chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
25
- 9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjgYEwfzAJ
26
- BgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUOIdbSMr3VFrTCO9/cTM0
27
- 0exHzBcwIgYDVR0RBBswGYEXbGFyc0BncmVpei1yZWluc2RvcmYuZGUwIgYDVR0S
28
- BBswGYEXbGFyc0BncmVpei1yZWluc2RvcmYuZGUwDQYJKoZIhvcNAQELBQADggGB
29
- AFWP7F/y3Oq3NgrqUOnjKOeDaBa7AqNhHS+PZg+C90lnJzMgOs4KKgZYxqSQVSab
30
- SCEmzIO/StkXY4NpJ4fYLrHemf/fJy1wPyu+fNdp5SEEUwEo+2toRFlzTe4u4LdS
31
- QC636nPPTMt8H3xz2wf/lUIUeo2Qc95Qt2BQM465ibbG9kmA3c7Sopx6yOabYOAl
32
- KPRbOSEPiWYcF9Suuz8Gdf8jxEtPlnZiwRvnYJ+IHMq3XQCJWPpMzdDMbtlgHbXE
33
- vq1zOTLMSYAS0UB3uionR4yo1hLz60odwkCm7qf0o2Ci/5OjtB0a89VuyqRU2vUJ
34
- QH95WBjDJ6lCCW7J0mrMPnJQSUFTmufsU6jOChvPaCeAzW1YwrsP/YKnvwueG7ip
35
- VOdW6RitjtFxhS7evRL0201+KUvLz12zZWWjOcujlQs64QprxOtiv/MiisKb1Ng+
36
- oL1mUdzB8KrZL4/WbG5YNX6UTtJbIOu9qEFbBAy4/jtIkJX+dlNoFwd4GXQW1YNO
37
- nA==
24
+ 9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
25
+ A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
26
+ 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
27
+ BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
28
+ ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
29
+ R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
30
+ haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
31
+ x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
32
+ dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
33
+ 5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
34
+ 5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
38
35
  -----END CERTIFICATE-----
39
- date: 2022-06-24 00:00:00.000000000 Z
36
+ date: 2024-03-01 00:00:00.000000000 Z
40
37
  dependencies: []
41
38
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
42
39
  9.3 and later.
@@ -46,7 +43,62 @@ email:
46
43
  executables: []
47
44
  extensions:
48
45
  - ext/extconf.rb
49
- extra_rdoc_files: []
46
+ extra_rdoc_files:
47
+ - Contributors.rdoc
48
+ - History.md
49
+ - README-OS_X.rdoc
50
+ - README-Windows.rdoc
51
+ - README.ja.md
52
+ - README.md
53
+ - ext/gvl_wrappers.c
54
+ - ext/gvl_wrappers.h
55
+ - ext/pg.c
56
+ - ext/pg.h
57
+ - ext/pg_binary_decoder.c
58
+ - ext/pg_binary_encoder.c
59
+ - ext/pg_coder.c
60
+ - ext/pg_connection.c
61
+ - ext/pg_copy_coder.c
62
+ - ext/pg_errors.c
63
+ - ext/pg_record_coder.c
64
+ - ext/pg_result.c
65
+ - ext/pg_text_decoder.c
66
+ - ext/pg_text_encoder.c
67
+ - ext/pg_tuple.c
68
+ - ext/pg_type_map.c
69
+ - ext/pg_type_map_all_strings.c
70
+ - ext/pg_type_map_by_class.c
71
+ - ext/pg_type_map_by_column.c
72
+ - ext/pg_type_map_by_mri_type.c
73
+ - ext/pg_type_map_by_oid.c
74
+ - ext/pg_type_map_in_ruby.c
75
+ - ext/pg_util.c
76
+ - ext/pg_util.h
77
+ - lib/pg.rb
78
+ - lib/pg/basic_type_map_based_on_result.rb
79
+ - lib/pg/basic_type_map_for_queries.rb
80
+ - lib/pg/basic_type_map_for_results.rb
81
+ - lib/pg/basic_type_registry.rb
82
+ - lib/pg/binary_decoder/date.rb
83
+ - lib/pg/binary_decoder/timestamp.rb
84
+ - lib/pg/binary_encoder/timestamp.rb
85
+ - lib/pg/coder.rb
86
+ - lib/pg/connection.rb
87
+ - lib/pg/exceptions.rb
88
+ - lib/pg/result.rb
89
+ - lib/pg/text_decoder/date.rb
90
+ - lib/pg/text_decoder/inet.rb
91
+ - lib/pg/text_decoder/json.rb
92
+ - lib/pg/text_decoder/numeric.rb
93
+ - lib/pg/text_decoder/timestamp.rb
94
+ - lib/pg/text_encoder/date.rb
95
+ - lib/pg/text_encoder/inet.rb
96
+ - lib/pg/text_encoder/json.rb
97
+ - lib/pg/text_encoder/numeric.rb
98
+ - lib/pg/text_encoder/timestamp.rb
99
+ - lib/pg/tuple.rb
100
+ - lib/pg/type_map_by_column.rb
101
+ - lib/pg/version.rb
50
102
  files:
51
103
  - ".appveyor.yml"
52
104
  - ".gems"
@@ -63,18 +115,21 @@ files:
63
115
  - BSDL
64
116
  - Contributors.rdoc
65
117
  - Gemfile
66
- - History.rdoc
118
+ - History.md
67
119
  - LICENSE
68
120
  - Manifest.txt
69
121
  - POSTGRES
70
122
  - README-OS_X.rdoc
71
123
  - README-Windows.rdoc
72
- - README.ja.rdoc
73
- - README.rdoc
124
+ - README.ja.md
125
+ - README.md
74
126
  - Rakefile
75
127
  - Rakefile.cross
76
128
  - certs/ged.pem
129
+ - certs/kanis@comcard.de.pem
77
130
  - certs/larskanis-2022.pem
131
+ - certs/larskanis-2023.pem
132
+ - certs/larskanis-2024.pem
78
133
  - ext/errorcodes.def
79
134
  - ext/errorcodes.rb
80
135
  - ext/errorcodes.txt
@@ -111,14 +166,23 @@ files:
111
166
  - lib/pg/basic_type_map_for_queries.rb
112
167
  - lib/pg/basic_type_map_for_results.rb
113
168
  - lib/pg/basic_type_registry.rb
114
- - lib/pg/binary_decoder.rb
169
+ - lib/pg/binary_decoder/date.rb
170
+ - lib/pg/binary_decoder/timestamp.rb
171
+ - lib/pg/binary_encoder/timestamp.rb
115
172
  - lib/pg/coder.rb
116
173
  - lib/pg/connection.rb
117
- - lib/pg/constants.rb
118
174
  - lib/pg/exceptions.rb
119
175
  - lib/pg/result.rb
120
- - lib/pg/text_decoder.rb
121
- - lib/pg/text_encoder.rb
176
+ - lib/pg/text_decoder/date.rb
177
+ - lib/pg/text_decoder/inet.rb
178
+ - lib/pg/text_decoder/json.rb
179
+ - lib/pg/text_decoder/numeric.rb
180
+ - lib/pg/text_decoder/timestamp.rb
181
+ - lib/pg/text_encoder/date.rb
182
+ - lib/pg/text_encoder/inet.rb
183
+ - lib/pg/text_encoder/json.rb
184
+ - lib/pg/text_encoder/numeric.rb
185
+ - lib/pg/text_encoder/timestamp.rb
122
186
  - lib/pg/tuple.rb
123
187
  - lib/pg/type_map_by_column.rb
124
188
  - lib/pg/version.rb
@@ -160,12 +224,13 @@ licenses:
160
224
  metadata:
161
225
  homepage_uri: https://github.com/ged/ruby-pg
162
226
  source_code_uri: https://github.com/ged/ruby-pg
163
- changelog_uri: https://github.com/ged/ruby-pg/blob/master/History.rdoc
227
+ changelog_uri: https://github.com/ged/ruby-pg/blob/master/History.md
164
228
  documentation_uri: http://deveiate.org/code/pg
165
- post_install_message:
166
229
  rdoc_options:
167
230
  - "--main"
168
- - README.rdoc
231
+ - README.md
232
+ - "--title"
233
+ - 'PG: The Ruby PostgreSQL Driver'
169
234
  require_paths:
170
235
  - lib
171
236
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -179,8 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
244
  - !ruby/object:Gem::Version
180
245
  version: '0'
181
246
  requirements: []
182
- rubygems_version: 3.3.7
183
- signing_key:
247
+ rubygems_version: 3.6.0.dev
184
248
  specification_version: 4
185
249
  summary: Pg is the Ruby interface to the PostgreSQL RDBMS
186
250
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/README.ja.rdoc DELETED
@@ -1,13 +0,0 @@
1
- = pg
2
-
3
- home :: https://github.com/ged/ruby-pg
4
- docs :: http://deveiate.org/code/pg
5
-
6
-
7
- == Description
8
-
9
- This file needs a translation of the English README. Pull requests, patches, or
10
- volunteers gladly accepted.
11
-
12
- Until such time, please accept my sincere apologies for not knowing Japanese.
13
-
data/README.rdoc DELETED
@@ -1,214 +0,0 @@
1
- = pg
2
-
3
- home :: https://github.com/ged/ruby-pg
4
- docs :: http://deveiate.org/code/pg
5
- clog :: link:/History.rdoc
6
-
7
- {<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/ged/ruby-pg">}[https://gitter.im/ged/ruby-pg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
8
-
9
-
10
- == Description
11
-
12
- Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
13
-
14
- It works with {PostgreSQL 9.3 and later}[http://www.postgresql.org/support/versioning/].
15
-
16
- A small example usage:
17
-
18
- #!/usr/bin/env ruby
19
-
20
- require 'pg'
21
-
22
- # Output a table of current connections to the DB
23
- conn = PG.connect( dbname: 'sales' )
24
- conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
25
- puts " PID | User | Query"
26
- result.each do |row|
27
- puts " %7d | %-16s | %s " %
28
- row.values_at('pid', 'usename', 'query')
29
- end
30
- end
31
-
32
- == Build Status
33
-
34
- {<img src="https://github.com/ged/ruby-pg/actions/workflows/source-gem.yml/badge.svg?branch=master" alt="Build Status Github Actions" />}[https://github.com/ged/ruby-pg/actions/workflows/source-gem.yml]
35
- {<img src="https://ci.appveyor.com/api/projects/status/gjx5axouf3b1wicp?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg-9j8l3]
36
- {<img src="https://app.travis-ci.com/larskanis/ruby-pg.svg?branch=master" alt="Build Status" />}[https://app.travis-ci.com/larskanis/ruby-pg]
37
-
38
- == Requirements
39
-
40
- * Ruby 2.4 or newer
41
- * PostgreSQL 9.3.x or later (with headers, -dev packages, etc).
42
-
43
- It usually works with earlier versions of Ruby/PostgreSQL as well, but those are
44
- not regularly tested.
45
-
46
-
47
- == Versioning
48
-
49
- We tag and release gems according to the {Semantic Versioning}[http://semver.org/] principle.
50
-
51
- As a result of this policy, you can (and should) specify a dependency on this gem using the {Pessimistic Version Constraint}[http://guides.rubygems.org/patterns/#pessimistic-version-constraint] with two digits of precision.
52
-
53
- For example:
54
-
55
- spec.add_dependency 'pg', '~> 1.0'
56
-
57
-
58
- == How To Install
59
-
60
- Install via RubyGems:
61
-
62
- gem install pg
63
-
64
- You may need to specify the path to the 'pg_config' program installed with
65
- Postgres:
66
-
67
- gem install pg -- --with-pg-config=<path to pg_config>
68
-
69
- If you're installing via Bundler, you can provide compile hints like so:
70
-
71
- bundle config build.pg --with-pg-config=<path to pg_config>
72
-
73
- See README-OS_X.rdoc for more information about installing under MacOS X, and
74
- README-Windows.rdoc for Windows build/installation instructions.
75
-
76
- There's also {a Google+ group}[http://goo.gl/TFy1U] and a
77
- {mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
78
- want to chat about something.
79
-
80
- If you want to install as a signed gem, the public certs of the gem signers
81
- can be found in {the `certs` directory}[https://github.com/ged/ruby-pg/tree/master/certs]
82
- of the repository.
83
-
84
-
85
- == Type Casts
86
-
87
- Pg can optionally type cast result values and query parameters in Ruby or
88
- native C code. This can speed up data transfers to and from the database,
89
- because String allocations are reduced and conversions in (slower) Ruby code
90
- can be omitted.
91
-
92
- Very basic type casting can be enabled by:
93
-
94
- conn.type_map_for_results = PG::BasicTypeMapForResults.new conn
95
- # ... this works for result value mapping:
96
- conn.exec("select 1, now(), '{2,3}'::int[]").values
97
- # => [[1, 2014-09-21 20:51:56 +0200, [2, 3]]]
98
-
99
- conn.type_map_for_queries = PG::BasicTypeMapForQueries.new conn
100
- # ... and this for param value mapping:
101
- conn.exec_params("SELECT $1::text, $2::text, $3::text", [1, 1.23, [2,3]]).values
102
- # => [["1", "1.2300000000000000E+00", "{2,3}"]]
103
-
104
- But Pg's type casting is highly customizable. That's why it's divided into
105
- 2 layers:
106
-
107
- === Encoders / Decoders (ext/pg_*coder.c, lib/pg/*coder.rb)
108
-
109
- This is the lower layer, containing encoding classes that convert Ruby
110
- objects for transmission to the DBMS and decoding classes to convert
111
- received data back to Ruby objects. The classes are namespaced according
112
- to their format and direction in PG::TextEncoder, PG::TextDecoder,
113
- PG::BinaryEncoder and PG::BinaryDecoder.
114
-
115
- It is possible to assign a type OID, format code (text or binary) and
116
- optionally a name to an encoder or decoder object. It's also possible
117
- to build composite types by assigning an element encoder/decoder.
118
- PG::Coder objects can be used to set up a PG::TypeMap or alternatively
119
- to convert single values to/from their string representation.
120
-
121
- The following PostgreSQL column types are supported by ruby-pg (TE = Text Encoder, TD = Text Decoder, BE = Binary Encoder, BD = Binary Decoder):
122
- * Integer: {TE}[rdoc-ref:PG::TextEncoder::Integer], {TD}[rdoc-ref:PG::TextDecoder::Integer], {BD}[rdoc-ref:PG::BinaryDecoder::Integer] 💡 No links? Switch to {here}[https://deveiate.org/code/pg/README_rdoc.html#label-Type+Casts] 💡
123
- * BE: {Int2}[rdoc-ref:PG::BinaryEncoder::Int2], {Int4}[rdoc-ref:PG::BinaryEncoder::Int4], {Int8}[rdoc-ref:PG::BinaryEncoder::Int8]
124
- * Float: {TE}[rdoc-ref:PG::TextEncoder::Float], {TD}[rdoc-ref:PG::TextDecoder::Float], {BD}[rdoc-ref:PG::BinaryDecoder::Float]
125
- * Numeric: {TE}[rdoc-ref:PG::TextEncoder::Numeric], {TD}[rdoc-ref:PG::TextDecoder::Numeric]
126
- * Boolean: {TE}[rdoc-ref:PG::TextEncoder::Boolean], {TD}[rdoc-ref:PG::TextDecoder::Boolean], {BE}[rdoc-ref:PG::BinaryEncoder::Boolean], {BD}[rdoc-ref:PG::BinaryDecoder::Boolean]
127
- * String: {TE}[rdoc-ref:PG::TextEncoder::String], {TD}[rdoc-ref:PG::TextDecoder::String], {BE}[rdoc-ref:PG::BinaryEncoder::String], {BD}[rdoc-ref:PG::BinaryDecoder::String]
128
- * Bytea: {TE}[rdoc-ref:PG::TextEncoder::Bytea], {TD}[rdoc-ref:PG::TextDecoder::Bytea], {BE}[rdoc-ref:PG::BinaryEncoder::Bytea], {BD}[rdoc-ref:PG::BinaryDecoder::Bytea]
129
- * Base64: {TE}[rdoc-ref:PG::TextEncoder::ToBase64], {TD}[rdoc-ref:PG::TextDecoder::FromBase64], {BE}[rdoc-ref:PG::BinaryEncoder::FromBase64], {BD}[rdoc-ref:PG::BinaryDecoder::ToBase64]
130
- * Timestamp:
131
- * TE: {local}[rdoc-ref:PG::TextEncoder::TimestampWithoutTimeZone], {UTC}[rdoc-ref:PG::TextEncoder::TimestampUtc], {with-TZ}[rdoc-ref:PG::TextEncoder::TimestampWithTimeZone]
132
- * TD: {local}[rdoc-ref:PG::TextDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::TextDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::TextDecoder::TimestampUtcToLocal]
133
- * BD: {local}[rdoc-ref:PG::BinaryDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::BinaryDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::BinaryDecoder::TimestampUtcToLocal]
134
- * Date: {TE}[rdoc-ref:PG::TextEncoder::Date], {TD}[rdoc-ref:PG::TextDecoder::Date]
135
- * JSON and JSONB: {TE}[rdoc-ref:PG::TextEncoder::JSON], {TD}[rdoc-ref:PG::TextDecoder::JSON]
136
- * Inet: {TE}[rdoc-ref:PG::TextEncoder::Inet], {TD}[rdoc-ref:PG::TextDecoder::Inet]
137
- * Array: {TE}[rdoc-ref:PG::TextEncoder::Array], {TD}[rdoc-ref:PG::TextDecoder::Array]
138
- * Composite Type (also called "Row" or "Record"): {TE}[rdoc-ref:PG::TextEncoder::Record], {TD}[rdoc-ref:PG::TextDecoder::Record]
139
-
140
- The following text formats can also be encoded although they are not used as column type:
141
- * COPY input and output data: {TE}[rdoc-ref:PG::TextEncoder::CopyRow], {TD}[rdoc-ref:PG::TextDecoder::CopyRow]
142
- * Literal for insertion into SQL string: {TE}[rdoc-ref:PG::TextEncoder::QuotedLiteral]
143
- * SQL-Identifier: {TE}[rdoc-ref:PG::TextEncoder::Identifier], {TD}[rdoc-ref:PG::TextDecoder::Identifier]
144
-
145
- === PG::TypeMap and derivations (ext/pg_type_map*.c, lib/pg/type_map*.rb)
146
-
147
- A TypeMap defines which value will be converted by which encoder/decoder.
148
- There are different type map strategies, implemented by several derivations
149
- of this class. They can be chosen and configured according to the particular
150
- needs for type casting. The default type map is PG::TypeMapAllStrings.
151
-
152
- A type map can be assigned per connection or per query respectively per
153
- result set. Type maps can also be used for COPY in and out data streaming.
154
- See PG::Connection#copy_data .
155
-
156
- The following base type maps are available:
157
- * PG::TypeMapAllStrings - encodes and decodes all values to and from strings (default)
158
- * PG::TypeMapByClass - selects encoder based on the class of the value to be sent
159
- * PG::TypeMapByColumn - selects encoder and decoder by column order
160
- * PG::TypeMapByOid - selects decoder by PostgreSQL type OID
161
- * PG::TypeMapInRuby - define a custom type map in ruby
162
-
163
- The following type maps are prefilled with type mappings from the PG::BasicTypeRegistry :
164
- * PG::BasicTypeMapForResults - a PG::TypeMapByOid prefilled with decoders for common PostgreSQL column types
165
- * PG::BasicTypeMapBasedOnResult - a PG::TypeMapByOid prefilled with encoders for common PostgreSQL column types
166
- * PG::BasicTypeMapForQueries - a PG::TypeMapByClass prefilled with encoders for common Ruby value classes
167
-
168
-
169
- == Contributing
170
-
171
- To report bugs, suggest features, or check out the source with Git,
172
- {check out the project page}[https://github.com/ged/ruby-pg].
173
-
174
- After checking out the source, run:
175
-
176
- $ rake newb
177
-
178
- This task will install any missing dependencies, run the tests/specs, and
179
- generate the API documentation.
180
-
181
- The current maintainers are Michael Granger <ged@FaerieMUD.org> and
182
- Lars Kanis <lars@greiz-reinsdorf.de>.
183
-
184
-
185
- == Copying
186
-
187
- Copyright (c) 1997-2019 by the authors.
188
-
189
- * Jeff Davis <ruby-pg@j-davis.com>
190
- * Guy Decoux (ts) <decoux@moulon.inra.fr>
191
- * Michael Granger <ged@FaerieMUD.org>
192
- * Lars Kanis <lars@greiz-reinsdorf.de>
193
- * Dave Lee
194
- * Eiji Matsumoto <usagi@ruby.club.or.jp>
195
- * Yukihiro Matsumoto <matz@ruby-lang.org>
196
- * Noboru Saitou <noborus@netlab.jp>
197
-
198
- You may redistribute this software under the same terms as Ruby itself; see
199
- https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
200
- for details.
201
-
202
- Portions of the code are from the PostgreSQL project, and are distributed
203
- under the terms of the PostgreSQL license, included in the file POSTGRES.
204
-
205
- Portions copyright LAIKA, Inc.
206
-
207
-
208
- == Acknowledgments
209
-
210
- See Contributors.rdoc for the many additional fine people that have contributed
211
- to this library over the years.
212
-
213
- We are thankful to the people at the ruby-list and ruby-dev mailing lists.
214
- And to the people who developed PostgreSQL.
@@ -1,23 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- module PG
5
- module BinaryDecoder
6
- # Convenience classes for timezone options
7
- class TimestampUtc < Timestamp
8
- def initialize(params={})
9
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC))
10
- end
11
- end
12
- class TimestampUtcToLocal < Timestamp
13
- def initialize(params={})
14
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL))
15
- end
16
- end
17
- class TimestampLocal < Timestamp
18
- def initialize(params={})
19
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL))
20
- end
21
- end
22
- end
23
- end # module PG
data/lib/pg/constants.rb DELETED
@@ -1,12 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- module PG::Constants
8
-
9
- # Most of these are defined in the extension.
10
-
11
- end # module PG::Constants
12
-