pg 1.4.5-x64-mingw32 → 1.5.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) 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 +41 -10
  5. data/.github/workflows/source-gem.yml +18 -12
  6. data/.gitignore +11 -2
  7. data/.travis.yml +2 -2
  8. data/{History.rdoc → History.md} +223 -153
  9. data/README.ja.md +276 -0
  10. data/README.md +286 -0
  11. data/Rakefile +12 -3
  12. data/Rakefile.cross +7 -11
  13. data/certs/larskanis-2023.pem +24 -0
  14. data/ext/pg.c +10 -28
  15. data/ext/pg.h +10 -5
  16. data/ext/pg_binary_decoder.c +79 -0
  17. data/ext/pg_binary_encoder.c +224 -0
  18. data/ext/pg_coder.c +16 -7
  19. data/ext/pg_connection.c +156 -60
  20. data/ext/pg_copy_coder.c +306 -17
  21. data/ext/pg_record_coder.c +5 -4
  22. data/ext/pg_result.c +88 -17
  23. data/ext/pg_text_decoder.c +28 -10
  24. data/ext/pg_text_encoder.c +22 -9
  25. data/ext/pg_tuple.c +34 -31
  26. data/ext/pg_type_map.c +3 -2
  27. data/ext/pg_type_map_all_strings.c +2 -2
  28. data/ext/pg_type_map_by_class.c +5 -3
  29. data/ext/pg_type_map_by_column.c +9 -3
  30. data/ext/pg_type_map_by_oid.c +7 -4
  31. data/ext/pg_type_map_in_ruby.c +5 -2
  32. data/lib/2.5/pg_ext.so +0 -0
  33. data/lib/2.6/pg_ext.so +0 -0
  34. data/lib/2.7/pg_ext.so +0 -0
  35. data/lib/3.0/pg_ext.so +0 -0
  36. data/lib/pg/basic_type_map_based_on_result.rb +21 -1
  37. data/lib/pg/basic_type_map_for_queries.rb +13 -8
  38. data/lib/pg/basic_type_map_for_results.rb +26 -3
  39. data/lib/pg/basic_type_registry.rb +30 -32
  40. data/lib/pg/binary_decoder/date.rb +9 -0
  41. data/lib/pg/binary_decoder/timestamp.rb +26 -0
  42. data/lib/pg/binary_encoder/timestamp.rb +20 -0
  43. data/lib/pg/coder.rb +15 -13
  44. data/lib/pg/connection.rb +82 -30
  45. data/lib/pg/exceptions.rb +7 -0
  46. data/lib/pg/text_decoder/date.rb +18 -0
  47. data/lib/pg/text_decoder/inet.rb +9 -0
  48. data/lib/pg/text_decoder/json.rb +14 -0
  49. data/lib/pg/text_decoder/numeric.rb +9 -0
  50. data/lib/pg/text_decoder/timestamp.rb +30 -0
  51. data/lib/pg/text_encoder/date.rb +12 -0
  52. data/lib/pg/text_encoder/inet.rb +28 -0
  53. data/lib/pg/text_encoder/json.rb +14 -0
  54. data/lib/pg/text_encoder/numeric.rb +9 -0
  55. data/lib/pg/text_encoder/timestamp.rb +24 -0
  56. data/lib/pg/version.rb +1 -1
  57. data/lib/pg.rb +44 -15
  58. data/lib/x64-mingw32/libpq.dll +0 -0
  59. data/pg.gemspec +4 -2
  60. data/rakelib/task_extension.rb +1 -1
  61. data/translation/.po4a-version +7 -0
  62. data/translation/po/all.pot +910 -0
  63. data/translation/po/ja.po +1047 -0
  64. data/translation/po4a.cfg +12 -0
  65. data.tar.gz.sig +0 -0
  66. metadata +109 -34
  67. metadata.gz.sig +0 -0
  68. data/README.ja.rdoc +0 -13
  69. data/README.rdoc +0 -233
  70. data/lib/pg/binary_decoder.rb +0 -23
  71. data/lib/pg/constants.rb +0 -12
  72. data/lib/pg/text_decoder.rb +0 -46
  73. data/lib/pg/text_encoder.rb +0 -59
@@ -0,0 +1,12 @@
1
+ [po_directory] po
2
+
3
+ [options] --master-charset UTF-8 \
4
+ --localized-charset UTF-8 \
5
+ --master-language en \
6
+ --option markdown \
7
+ --keep 0 \
8
+ --package-name Pg \
9
+ --package-version 1.4.6 \
10
+ --copyright-holder 'Pg authors'
11
+
12
+ [type:text] ../README.md ja:../README.ja.md
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,36 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.5.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Michael Granger
8
8
  - Lars Kanis
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
- MIIDLjCCAhagAwIBAgIBCjANBgkqhkiG9w0BAQsFADA9MQ4wDAYDVQQDDAVrYW5p
15
- czEXMBUGCgmSJomT8ixkARkWB2NvbWNhcmQxEjAQBgoJkiaJk/IsZAEZFgJkZTAe
16
- Fw0yMjA0MTExMTMwNTNaFw0yMzA0MTExMTMwNTNaMD0xDjAMBgNVBAMMBWthbmlz
17
- MRcwFQYKCZImiZPyLGQBGRYHY29tY2FyZDESMBAGCgmSJomT8ixkARkWAmRlMIIB
18
- IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApop+rNmg35bzRugZ21VMGqI6
19
- HGzPLO4VHYncWn/xmgPU/ZMcZdfj6MzIaZJ/czXyt4eHpBk1r8QOV3gBXnRXEjVW
20
- 9xi+EdVOkTV2/AVFKThcbTAQGiF/bT1n2M+B1GTybRzMg6hyhOJeGPqIhLfJEpxn
21
- lJi4+ENAVT4MpqHEAGB8yFoPC0GqiOHQsdHxQV3P3c2OZqG+yJey74QtwA2tLcLn
22
- Q53c63+VLGsOjODl1yPn/2ejyq8qWu6ahfTxiIlSar2UbwtaQGBDFdb2CXgEufXT
23
- L7oaPxlmj+Q2oLOfOnInd2Oxop59HoJCQPsg8f921J43NCQGA8VHK6paxIRDLQID
24
- AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUvgTdT7fe
25
- x17ugO3IOsjEJwW7KP4wDQYJKoZIhvcNAQELBQADggEBAILiaB/unSVBfX5n7uL8
26
- veGGCOHuGYhCGqspb6mYiCx0dmV3RPRiEfGDLfzcXbHNx/3AjygcxH4Slr+pmaxr
27
- 04Xli3WurocnjoANSWqCwpHH3OhSVxFgBNrCa3OMWcIr0xKH+I7PXA80SXe0pzfg
28
- ePjpzTY71j+rcyRJqWiU5/zwdUaCCelBJscxh/0IaNcz67ocCEMRj0n4m5HFEmZL
29
- 9zKkMZFoOjxRQjcL84QU7ZXnnFR5HG8nLw+NqWjo49W6MBQ9HGFda2tk3OpBhyWS
30
- sc3NyOkGUGdfiee5VRG31Sh3LLON3YGED+zZAS+ZF6598y4vhv8MBLa1Oy357byC
31
- tTg=
14
+ MIIEBDCCAmygAwIBAgIBAjANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
15
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yMzAyMTUxNzQxMTVaFw0yNDAy
16
+ MTUxNzQxMTVaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
17
+ PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
18
+ mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
19
+ eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
20
+ 8nBMvR0mHo77kIkapHc26UzVq/G0nKLfDsIHXVylto3PjzOumjG6GhmFN4r3cP6e
21
+ SDfl1FSeRYVpt4kmQULz/zdSaOH3AjAq7PM2Z91iGwQvoUXMANH2v89OWjQO/NHe
22
+ JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
23
+ eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhNexUtbjk6P8emmXOJi5
24
+ chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
25
+ 9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
26
+ A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
27
+ 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEAQAcuTARfiiVUVx5KURICfdTM2Kd7LhOn
28
+ qt3Vs4ANGvT226LEp3RnQ+kWGQYMRb3cw3LY2TNQRPlnZxE994mgjBscN4fbjXqO
29
+ T0JbVpeszRZa5k1goggbnWT7CO7yU7WcHh13DaSubY7HUpAJn2xz9w2stxQfN/EE
30
+ VMlnDJ1P7mUHAvpK8X9j9h7Xlc1niViT18MYwux8mboVTryrLr+clATUkkM3yBF0
31
+ RV+c34ReW5eXO9Tr6aKTxh/pFC9ggDT6jOxuJgSvG8HWJzVf4NDvMavIas4KYjiI
32
+ BU6CpWaG5NxicqL3BERi52U43HV08br+LNVpb7Rekgve/PJuSFnAR015bhSRXe5U
33
+ vBioD1qW2ZW9tXg8Ww2IfDaO5a1So5Xby51rhNlyo6ATj2NkuLWZUKPKHhAz0TKm
34
+ Dzx/gFSOrRoCt2mXNgrmcAfr386AfaMvCh7cXqdxZwmVo7ILZCYXck0pajvubsDd
35
+ NUIIFkVXvd1odFyK9LF1RFAtxn/iAmpx
32
36
  -----END CERTIFICATE-----
33
- date: 2022-11-17 00:00:00.000000000 Z
37
+ date: 2023-04-24 00:00:00.000000000 Z
34
38
  dependencies: []
35
39
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
36
40
  9.3 and later.
@@ -39,7 +43,62 @@ email:
39
43
  - lars@greiz-reinsdorf.de
40
44
  executables: []
41
45
  extensions: []
42
- 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
43
102
  files:
44
103
  - ".appveyor.yml"
45
104
  - ".gems"
@@ -56,18 +115,19 @@ files:
56
115
  - BSDL
57
116
  - Contributors.rdoc
58
117
  - Gemfile
59
- - History.rdoc
118
+ - History.md
60
119
  - LICENSE
61
120
  - Manifest.txt
62
121
  - POSTGRES
63
122
  - README-OS_X.rdoc
64
123
  - README-Windows.rdoc
65
- - README.ja.rdoc
66
- - README.rdoc
124
+ - README.ja.md
125
+ - README.md
67
126
  - Rakefile
68
127
  - Rakefile.cross
69
128
  - certs/ged.pem
70
129
  - certs/larskanis-2022.pem
130
+ - certs/larskanis-2023.pem
71
131
  - ext/errorcodes.def
72
132
  - ext/errorcodes.rb
73
133
  - ext/errorcodes.txt
@@ -108,14 +168,23 @@ files:
108
168
  - lib/pg/basic_type_map_for_queries.rb
109
169
  - lib/pg/basic_type_map_for_results.rb
110
170
  - lib/pg/basic_type_registry.rb
111
- - lib/pg/binary_decoder.rb
171
+ - lib/pg/binary_decoder/date.rb
172
+ - lib/pg/binary_decoder/timestamp.rb
173
+ - lib/pg/binary_encoder/timestamp.rb
112
174
  - lib/pg/coder.rb
113
175
  - lib/pg/connection.rb
114
- - lib/pg/constants.rb
115
176
  - lib/pg/exceptions.rb
116
177
  - lib/pg/result.rb
117
- - lib/pg/text_decoder.rb
118
- - lib/pg/text_encoder.rb
178
+ - lib/pg/text_decoder/date.rb
179
+ - lib/pg/text_decoder/inet.rb
180
+ - lib/pg/text_decoder/json.rb
181
+ - lib/pg/text_decoder/numeric.rb
182
+ - lib/pg/text_decoder/timestamp.rb
183
+ - lib/pg/text_encoder/date.rb
184
+ - lib/pg/text_encoder/inet.rb
185
+ - lib/pg/text_encoder/json.rb
186
+ - lib/pg/text_encoder/numeric.rb
187
+ - lib/pg/text_encoder/timestamp.rb
119
188
  - lib/pg/tuple.rb
120
189
  - lib/pg/type_map_by_column.rb
121
190
  - lib/pg/version.rb
@@ -152,18 +221,24 @@ files:
152
221
  - sample/test_binary_values.rb
153
222
  - sample/wal_shipper.rb
154
223
  - sample/warehouse_partitions.rb
224
+ - translation/.po4a-version
225
+ - translation/po/all.pot
226
+ - translation/po/ja.po
227
+ - translation/po4a.cfg
155
228
  homepage: https://github.com/ged/ruby-pg
156
229
  licenses:
157
230
  - BSD-2-Clause
158
231
  metadata:
159
232
  homepage_uri: https://github.com/ged/ruby-pg
160
233
  source_code_uri: https://github.com/ged/ruby-pg
161
- changelog_uri: https://github.com/ged/ruby-pg/blob/master/History.rdoc
234
+ changelog_uri: https://github.com/ged/ruby-pg/blob/master/History.md
162
235
  documentation_uri: http://deveiate.org/code/pg
163
- post_install_message:
236
+ post_install_message:
164
237
  rdoc_options:
165
238
  - "--main"
166
- - README.rdoc
239
+ - README.md
240
+ - "--title"
241
+ - 'PG: The Ruby PostgreSQL Driver'
167
242
  require_paths:
168
243
  - lib
169
244
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -180,8 +255,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
255
  - !ruby/object:Gem::Version
181
256
  version: '0'
182
257
  requirements: []
183
- rubygems_version: 3.3.4
184
- signing_key:
258
+ rubygems_version: 3.3.26
259
+ signing_key:
185
260
  specification_version: 4
186
261
  summary: Pg is the Ruby interface to the PostgreSQL RDBMS
187
262
  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,233 +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, install all dependencies:
175
-
176
- $ bundle install
177
-
178
- Cleanup extension files, packaging files, test databases:
179
-
180
- $ rake clean
181
-
182
- Compile extension:
183
-
184
- $ rake compile
185
-
186
- Run tests/specs with PostgreSQL tools like `initdb` in the path:
187
-
188
- $ PATH=$PATH:/usr/lib/postgresql/14/bin rake test
189
-
190
- Or run a specific test with the line number:
191
-
192
- $ PATH=$PATH:/usr/lib/postgresql/14/bin rspec -Ilib -fd spec/pg/connection_spec.rb:455
193
-
194
- Generate the API documentation:
195
-
196
- $ rake docs
197
-
198
- Make sure, that all bugs and new features are verified by tests.
199
-
200
- The current maintainers are Michael Granger <ged@FaerieMUD.org> and
201
- Lars Kanis <lars@greiz-reinsdorf.de>.
202
-
203
-
204
- == Copying
205
-
206
- Copyright (c) 1997-2022 by the authors.
207
-
208
- * Jeff Davis <ruby-pg@j-davis.com>
209
- * Guy Decoux (ts) <decoux@moulon.inra.fr>
210
- * Michael Granger <ged@FaerieMUD.org>
211
- * Lars Kanis <lars@greiz-reinsdorf.de>
212
- * Dave Lee
213
- * Eiji Matsumoto <usagi@ruby.club.or.jp>
214
- * Yukihiro Matsumoto <matz@ruby-lang.org>
215
- * Noboru Saitou <noborus@netlab.jp>
216
-
217
- You may redistribute this software under the same terms as Ruby itself; see
218
- https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
219
- for details.
220
-
221
- Portions of the code are from the PostgreSQL project, and are distributed
222
- under the terms of the PostgreSQL license, included in the file POSTGRES.
223
-
224
- Portions copyright LAIKA, Inc.
225
-
226
-
227
- == Acknowledgments
228
-
229
- See Contributors.rdoc for the many additional fine people that have contributed
230
- to this library over the years.
231
-
232
- We are thankful to the people at the ruby-list and ruby-dev mailing lists.
233
- 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
-
@@ -1,46 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'date'
5
- require 'json'
6
-
7
- module PG
8
- module TextDecoder
9
- class Date < SimpleDecoder
10
- def decode(string, tuple=nil, field=nil)
11
- if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
12
- ::Date.new $1.to_i, $2.to_i, $3.to_i
13
- else
14
- string
15
- end
16
- end
17
- end
18
-
19
- class JSON < SimpleDecoder
20
- def decode(string, tuple=nil, field=nil)
21
- ::JSON.parse(string, quirks_mode: true)
22
- end
23
- end
24
-
25
- # Convenience classes for timezone options
26
- class TimestampUtc < Timestamp
27
- def initialize(params={})
28
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC))
29
- end
30
- end
31
- class TimestampUtcToLocal < Timestamp
32
- def initialize(params={})
33
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL))
34
- end
35
- end
36
- class TimestampLocal < Timestamp
37
- def initialize(params={})
38
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL))
39
- end
40
- end
41
-
42
- # For backward compatibility:
43
- TimestampWithoutTimeZone = TimestampLocal
44
- TimestampWithTimeZone = Timestamp
45
- end
46
- end # module PG
@@ -1,59 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'json'
5
- require 'ipaddr'
6
-
7
- module PG
8
- module TextEncoder
9
- class Date < SimpleEncoder
10
- def encode(value)
11
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
12
- end
13
- end
14
-
15
- class TimestampWithoutTimeZone < SimpleEncoder
16
- def encode(value)
17
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N") : value
18
- end
19
- end
20
-
21
- class TimestampUtc < SimpleEncoder
22
- def encode(value)
23
- value.respond_to?(:utc) ? value.utc.strftime("%Y-%m-%d %H:%M:%S.%N") : value
24
- end
25
- end
26
-
27
- class TimestampWithTimeZone < SimpleEncoder
28
- def encode(value)
29
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N %:z") : value
30
- end
31
- end
32
-
33
- class JSON < SimpleEncoder
34
- def encode(value)
35
- ::JSON.generate(value, quirks_mode: true)
36
- end
37
- end
38
-
39
- class Inet < SimpleEncoder
40
- def encode(value)
41
- case value
42
- when IPAddr
43
- default_prefix = (value.family == Socket::AF_INET ? 32 : 128)
44
- s = value.to_s
45
- if value.respond_to?(:prefix)
46
- prefix = value.prefix
47
- else
48
- range = value.to_range
49
- prefix = default_prefix - Math.log(((range.end.to_i - range.begin.to_i) + 1), 2).to_i
50
- end
51
- s << "/" << prefix.to_s if prefix != default_prefix
52
- s
53
- else
54
- value
55
- end
56
- end
57
- end
58
- end
59
- end # module PG