pg 0.18.2 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/.appveyor.yml +42 -0
  4. data/.gems +6 -0
  5. data/.github/workflows/binary-gems.yml +117 -0
  6. data/.github/workflows/source-gem.yml +141 -0
  7. data/.gitignore +22 -0
  8. data/.hgsigs +34 -0
  9. data/.hgtags +41 -0
  10. data/.irbrc +23 -0
  11. data/.pryrc +23 -0
  12. data/.tm_properties +21 -0
  13. data/.travis.yml +49 -0
  14. data/BSDL +2 -2
  15. data/Gemfile +14 -0
  16. data/History.md +884 -0
  17. data/Manifest.txt +8 -21
  18. data/README-Windows.rdoc +17 -28
  19. data/README.ja.md +300 -0
  20. data/README.md +286 -0
  21. data/Rakefile +40 -131
  22. data/Rakefile.cross +88 -70
  23. data/certs/ged.pem +24 -0
  24. data/certs/larskanis-2022.pem +26 -0
  25. data/certs/larskanis-2023.pem +24 -0
  26. data/ext/errorcodes.def +113 -0
  27. data/ext/errorcodes.rb +1 -1
  28. data/ext/errorcodes.txt +36 -2
  29. data/ext/extconf.rb +124 -54
  30. data/ext/gvl_wrappers.c +8 -0
  31. data/ext/gvl_wrappers.h +44 -33
  32. data/ext/pg.c +227 -201
  33. data/ext/pg.h +99 -100
  34. data/ext/pg_binary_decoder.c +164 -16
  35. data/ext/pg_binary_encoder.c +249 -22
  36. data/ext/pg_coder.c +189 -44
  37. data/ext/pg_connection.c +1874 -1174
  38. data/ext/pg_copy_coder.c +398 -42
  39. data/ext/pg_errors.c +1 -1
  40. data/ext/pg_record_coder.c +522 -0
  41. data/ext/pg_result.c +727 -232
  42. data/ext/pg_text_decoder.c +629 -43
  43. data/ext/pg_text_encoder.c +269 -102
  44. data/ext/pg_tuple.c +572 -0
  45. data/ext/pg_type_map.c +64 -23
  46. data/ext/pg_type_map_all_strings.c +21 -7
  47. data/ext/pg_type_map_by_class.c +59 -27
  48. data/ext/pg_type_map_by_column.c +86 -43
  49. data/ext/pg_type_map_by_mri_type.c +49 -20
  50. data/ext/pg_type_map_by_oid.c +62 -29
  51. data/ext/pg_type_map_in_ruby.c +56 -22
  52. data/ext/{util.c → pg_util.c} +12 -12
  53. data/ext/{util.h → pg_util.h} +2 -2
  54. data/lib/pg/basic_type_map_based_on_result.rb +67 -0
  55. data/lib/pg/basic_type_map_for_queries.rb +198 -0
  56. data/lib/pg/basic_type_map_for_results.rb +104 -0
  57. data/lib/pg/basic_type_registry.rb +299 -0
  58. data/lib/pg/binary_decoder/date.rb +9 -0
  59. data/lib/pg/binary_decoder/timestamp.rb +26 -0
  60. data/lib/pg/binary_encoder/timestamp.rb +20 -0
  61. data/lib/pg/coder.rb +36 -13
  62. data/lib/pg/connection.rb +797 -77
  63. data/lib/pg/exceptions.rb +16 -2
  64. data/lib/pg/result.rb +24 -7
  65. data/lib/pg/text_decoder/date.rb +18 -0
  66. data/lib/pg/text_decoder/inet.rb +9 -0
  67. data/lib/pg/text_decoder/json.rb +14 -0
  68. data/lib/pg/text_decoder/numeric.rb +9 -0
  69. data/lib/pg/text_decoder/timestamp.rb +30 -0
  70. data/lib/pg/text_encoder/date.rb +12 -0
  71. data/lib/pg/text_encoder/inet.rb +28 -0
  72. data/lib/pg/text_encoder/json.rb +14 -0
  73. data/lib/pg/text_encoder/numeric.rb +9 -0
  74. data/lib/pg/text_encoder/timestamp.rb +24 -0
  75. data/lib/pg/tuple.rb +30 -0
  76. data/lib/pg/type_map_by_column.rb +3 -2
  77. data/lib/pg/version.rb +4 -0
  78. data/lib/pg.rb +106 -41
  79. data/misc/openssl-pg-segfault.rb +31 -0
  80. data/misc/postgres/History.txt +9 -0
  81. data/misc/postgres/Manifest.txt +5 -0
  82. data/misc/postgres/README.txt +21 -0
  83. data/misc/postgres/Rakefile +21 -0
  84. data/misc/postgres/lib/postgres.rb +16 -0
  85. data/misc/ruby-pg/History.txt +9 -0
  86. data/misc/ruby-pg/Manifest.txt +5 -0
  87. data/misc/ruby-pg/README.txt +21 -0
  88. data/misc/ruby-pg/Rakefile +21 -0
  89. data/misc/ruby-pg/lib/ruby/pg.rb +16 -0
  90. data/pg.gemspec +34 -0
  91. data/rakelib/task_extension.rb +46 -0
  92. data/sample/array_insert.rb +1 -1
  93. data/sample/async_api.rb +4 -8
  94. data/sample/async_copyto.rb +1 -1
  95. data/sample/async_mixed.rb +1 -1
  96. data/sample/check_conn.rb +1 -1
  97. data/sample/copydata.rb +71 -0
  98. data/sample/copyfrom.rb +1 -1
  99. data/sample/copyto.rb +1 -1
  100. data/sample/cursor.rb +1 -1
  101. data/sample/disk_usage_report.rb +6 -15
  102. data/sample/issue-119.rb +2 -2
  103. data/sample/losample.rb +1 -1
  104. data/sample/minimal-testcase.rb +2 -2
  105. data/sample/notify_wait.rb +1 -1
  106. data/sample/pg_statistics.rb +6 -15
  107. data/sample/replication_monitor.rb +9 -18
  108. data/sample/test_binary_values.rb +1 -1
  109. data/sample/wal_shipper.rb +2 -2
  110. data/sample/warehouse_partitions.rb +8 -17
  111. data/translation/.po4a-version +7 -0
  112. data/translation/po/all.pot +936 -0
  113. data/translation/po/ja.po +1036 -0
  114. data/translation/po4a.cfg +12 -0
  115. data.tar.gz.sig +0 -0
  116. metadata +130 -201
  117. metadata.gz.sig +0 -0
  118. data/ChangeLog +0 -5545
  119. data/History.rdoc +0 -313
  120. data/README.ja.rdoc +0 -14
  121. data/README.rdoc +0 -161
  122. data/lib/pg/basic_type_mapping.rb +0 -399
  123. data/lib/pg/constants.rb +0 -11
  124. data/lib/pg/text_decoder.rb +0 -42
  125. data/lib/pg/text_encoder.rb +0 -27
  126. data/spec/data/expected_trace.out +0 -26
  127. data/spec/data/random_binary_data +0 -0
  128. data/spec/helpers.rb +0 -355
  129. data/spec/pg/basic_type_mapping_spec.rb +0 -251
  130. data/spec/pg/connection_spec.rb +0 -1535
  131. data/spec/pg/result_spec.rb +0 -449
  132. data/spec/pg/type_map_by_class_spec.rb +0 -138
  133. data/spec/pg/type_map_by_column_spec.rb +0 -222
  134. data/spec/pg/type_map_by_mri_type_spec.rb +0 -136
  135. data/spec/pg/type_map_by_oid_spec.rb +0 -149
  136. data/spec/pg/type_map_in_ruby_spec.rb +0 -164
  137. data/spec/pg/type_map_spec.rb +0 -22
  138. data/spec/pg/type_spec.rb +0 -688
  139. data/spec/pg_spec.rb +0 -50
data/History.rdoc DELETED
@@ -1,313 +0,0 @@
1
- == v0.18.2 [2015-05-14] Michael Granger <ged@FaerieMUD.org>
2
-
3
- Enhancements:
4
-
5
- - Allow URI connection string (thanks to Chris Bandy)
6
-
7
- Bugfixes:
8
-
9
- - Speedups and fixes for PG::TextDecoder::Identifier and quoting behavior
10
- - Revert addition of PG::Connection#hostaddr [#202].
11
- - Fix decoding of fractional timezones and timestamps [#203]
12
- - Fixes for non-C99 compilers
13
- - Avoid possible symbol name clash when linking againt static libpq.
14
-
15
-
16
- == v0.18.1 [2015-01-05] Michael Granger <ged@FaerieMUD.org>
17
-
18
- Correct the minimum compatible Ruby version to 1.9.3. #199
19
-
20
-
21
- == v0.18.0 [2015-01-01] Michael Granger <ged@FaerieMUD.org>
22
-
23
- Bugfixes:
24
- - Fix OID to Integer mapping (it is unsigned now). #187
25
- - Fix possible segfault in conjunction with notice receiver. #185
26
-
27
- Enhancements:
28
-
29
- - Add an extensible type cast system.
30
- - A lot of performance improvements.
31
- - Return frozen String objects for result field names.
32
- - Add PG::Result#stream_each and #stream_each_row as fast helpers for
33
- the single row mode.
34
- - Add Enumerator variant to PG::Result#each and #each_row.
35
- - Add PG::Connection#conninfo and #hostaddr.
36
- - Add PG.init_openssl and PG.init_ssl methods.
37
- - Add PG::Result.inspect
38
- - Force zero termination for all text strings that are given to libpq.
39
- It raises an ArgumentError if the string contains a null byte.
40
- - Update Windows cross build to PostgreSQL 9.3.
41
-
42
-
43
-
44
- == v0.17.1 [2013-12-18] Michael Granger <ged@FaerieMUD.org>
45
-
46
- Bugfixes:
47
-
48
- - Fix compatibility with signal handlers defined in Ruby. This reverts
49
- cancelation of queries running on top of the blocking libpq API (like
50
- Connection#exec) in case of signals. As an alternative the #async_exec
51
- can be used, which is reverted to use the non-blocking API, again.
52
- - Wrap PQcancel to be called without GVL. It internally waits for
53
- the canceling connection.
54
-
55
- Documentation fixes:
56
-
57
- - Fix documentation for PG::Connection::conndefaults.
58
-
59
-
60
- == v0.17.0 [2013-09-15] Michael Granger <ged@FaerieMUD.org>
61
-
62
- Bugfixes:
63
-
64
- - Fix crash by calling PQsend* and PQisBusy without GVL (#171).
65
-
66
- Enhancements:
67
-
68
- - Add method PG::Connection#copy_data.
69
- - Add a Gemfile to allow installation of dependencies with bundler.
70
- - Add compatibility with rake-compiler-dev-box.
71
- - Return self from PG::Result#check instead of nil. This allows
72
- to stack method calls.
73
-
74
-
75
- == v0.16.0 [2013-07-22] Michael Granger <ged@FaerieMUD.org>
76
-
77
- Bugfixes:
78
-
79
- - Avoid warnings about uninitialized instance variables.
80
- - Use a more standard method of adding library and include directories.
81
- This fixes build on AIX (Github #7) and Solaris (#164).
82
- - Cancel the running query, if a thread is about to be killed (e.g. by CTRL-C).
83
- - Fix GVL issue with wait_for_notify/notifies and notice callbacks.
84
- - Set proper encoding on the string returned by quote_ident, escape_literal
85
- and escape_identifier (#163).
86
- - Use nil as PG::Error#result in case of a NULL-result from libpq (#166).
87
- - Recalculate the timeout of conn#wait_for_notify and conn#block in case
88
- of socket events that require re-runs of select().
89
-
90
- Documentation fixes:
91
-
92
- - Fix non working example for PGresult#error_field.
93
-
94
- Enhancements:
95
-
96
- - Add unique exception classes for each PostgreSQL error type (#5).
97
- - Return result of the block in conn#transaction instead of nil (#158).
98
- - Allow 'rake compile' and 'rake gem' on non mercurial repos.
99
- - Add support for PG_DIAG_*_NAME error fields of PostgreSQL-9.3 (#161).
100
-
101
-
102
- == v0.15.1 [2013-04-08] Michael Granger <ged@FaerieMUD.org>
103
-
104
- Bugfixes:
105
-
106
- - Shorten application_name to avoid warnings about truncated identifier.
107
-
108
-
109
- == v0.15.0 [2013-03-03] Michael Granger <ged@FaerieMUD.org>
110
-
111
- Bugfixes:
112
-
113
- - Fix segfault in PG::Result#field_values when called with non String value.
114
- - Fix encoding of messages delivered by notice callbacks.
115
- - Fix text encoding for Connection#wait_for_notify and Connection#notifies.
116
- - Fix 'Bad file descriptor' problems under Windows: wrong behaviour of
117
- #wait_for_notify() and timeout handling of #block on Ruby 1.9.
118
-
119
- Documentation fixes:
120
-
121
- - conn#socket() can not be used with IO.for_fd() on Windows.
122
-
123
- Enhancements:
124
-
125
- - Tested under Ruby 2.0.0p0.
126
- - Add single row mode of PostgreSQL 9.2.
127
- - Set fallback_application_name to programm name $0. Thanks to Will Leinweber
128
- for the patch.
129
- - Release Ruby's GVL while calls to blocking libpq functions to allow better
130
- concurrency in threaded applications.
131
- - Refactor different variants of waiting for the connection socket.
132
- - Make use of rb_thread_fd_select() on Ruby 1.9 and avoid deprecated
133
- rb_thread_select().
134
- - Add an example of how to insert array data using a prepared statement (#145).
135
- - Add continous integration tests on travis-ci.org.
136
- - Add PG::Result#each_row for iterative over result sets by row. Thanks to
137
- Aaron Patterson for the patch.
138
- - Add a PG::Connection#socket_io method for fetching a (non-autoclosing) IO
139
- object for the connection's socket.
140
-
141
- Specs:
142
-
143
- - Fix various specs to run on older PostgreSQL and Ruby versions.
144
- - Avoid fork() in specs to allow usage on Windows and JRuby.
145
-
146
-
147
- == v0.14.1 [2012-09-02] Michael Granger <ged@FaerieMUD.org>
148
-
149
- Important bugfix:
150
-
151
- - Fix stack overflow bug in PG::Result#values and #column_values (#135). Thanks
152
- to everyone who reported the bug, and Lars Kanis especially for figuring out
153
- the problem.
154
-
155
- PostgreSQL 9.2 beta fixes:
156
-
157
- - Recognize PGRES_SINGLE_TUPLE as OK when checking PGresult (Jeremy Evans)
158
-
159
- Documentation fixes:
160
-
161
- - Add note about the usage scope of the result object received by the
162
- #set_notice_receiver block. (Lars Kanis)
163
- - Add PGRES_COPY_BOTH to documentation of PG::Result#result_status. (Lars Kanis)
164
- - Add some documentation to PG::Result#fnumber (fix for #139)
165
-
166
-
167
- == v0.14.0 [2012-06-17] Michael Granger <ged@FaerieMUD.org>
168
-
169
- Bugfixes:
170
- #47, #104
171
-
172
-
173
- New Methods for PostgreSQL 9 and async API support:
174
- PG
175
- - ::library_version
176
-
177
- PG::Connection
178
- - ::ping
179
- - #escape_literal
180
- - #escape_identifier
181
- - #set_default_encoding
182
-
183
- PG::Result
184
- - #check
185
-
186
-
187
- New Samples:
188
-
189
- This release also comes with a collection of contributed sample scripts for
190
- doing resource-utilization reports, graphing database statistics,
191
- monitoring for replication lag, shipping WAL files for replication,
192
- automated tablespace partitioning, etc. See the samples/ directory.
193
-
194
-
195
- == v0.13.2 [2012-02-22] Michael Granger <ged@FaerieMUD.org>
196
-
197
- - Make builds against PostgreSQL earlier than 8.3 fail with a descriptive
198
- message instead of a compile failure.
199
-
200
-
201
- == v0.13.1 [2012-02-12] Michael Granger <ged@FaerieMUD.org>
202
-
203
- - Made use of a finished PG::Connection raise a PG::Error instead of
204
- a fatal error (#110).
205
- - Added missing BSDL license file (#108)
206
-
207
-
208
- == v0.13.0 [2012-02-09] Michael Granger <ged@FaerieMUD.org>
209
-
210
- Reorganization of modules/classes to be better Ruby citizens (with backward-compatible aliases):
211
- - Created toplevel namespace 'PG' to correspond with the gem name.
212
- - Renamed PGconn to PG::Connection (with ::PGconn alias)
213
- - Renamed PGresult to PG::Result (with ::PGresult alias)
214
- - Renamed PGError to PG::Error (with ::PGError alias)
215
- - Declare all constants inside PG::Constants, then include them in
216
- PG::Connection and PG::Result for backward-compatibility, and
217
- in PG for convenience.
218
- - Split the extension source up by class/module.
219
- - Removed old compatibility code for PostgreSQL versions < 8.3
220
-
221
- Documentation:
222
- - Clarified licensing, updated to Ruby 1.9's license.
223
- - Merged authors list, added some missing people to the Contributor's
224
- list.
225
- - Cleaned up the sample/ directory
226
- - Making contact info a bit clearer, link to the Google+ page and
227
- the mailing list
228
-
229
- Enhancements:
230
- - Added a convenience method: PG.connect -> PG::Connection.new
231
-
232
- Bugfixes:
233
- - Fixed LATIN5-LATIN10 Postgres<->Ruby encoding conversions
234
-
235
-
236
-
237
- == v0.12.2 [2012-01-03] Michael Granger <ged@FaerieMUD.org>
238
-
239
- - Fix for the 1.8.7 breakage introduced by the st.h fix for alternative Ruby
240
- implementations (#97 and #98). Thanks to Lars Kanis for the patch.
241
- - Encode error messages with the connection's encoding under 1.9 (#96)
242
-
243
-
244
- == v0.12.1 [2011-12-14] Michael Granger <ged@FaerieMUD.org>
245
-
246
- - Made rake-compiler a dev dependency, as Rubygems doesn't use the Rakefile
247
- for compiling the extension. Thanks to eolamey@bitbucket and Jeremy Evans
248
- for pointing this out.
249
- - Added an explicit include for ruby/st.h for implementations that need it
250
- (fixes #95).
251
-
252
-
253
- == v0.12.0 [2011-12-07] Michael Granger <ged@FaerieMUD.org>
254
-
255
- - PGconn#wait_for_notify
256
- * send nil as the payload argument if the NOTIFY didn't have one.
257
- * accept a nil argument for no timeout (Sequel support)
258
- * Fixed API docs
259
- * Taint and encode event name and payload
260
- - Handle errors while rb_thread_select()ing in PGconn#block.
261
- (Brian Weaver).
262
- - Fixes for Win32 async queries (Rafał Bigaj)
263
- - Memory leak fixed: Closing opened WSA event. (rafal)
264
- - Fixes for #66 Win32 asynchronous queries hang on connection
265
- error. (rafal)
266
- - Fixed a typo in PGconn#error_message's documentation
267
- - fixing unused variable warnings for ruby 1.9.3 (Aaron Patterson)
268
- - Build system bugfixes
269
- - Converted to Hoe
270
- - Updates for the Win32 binary gem builds (Lars Kanis)
271
-
272
-
273
- == v0.11.0 [2011-02-09] Michael Granger <ged@FaerieMUD.org>
274
-
275
- Enhancements:
276
-
277
- * Added a PGresult#values method to fetch all result rows as an Array of
278
- Arrays. Thanks to Jason Yanowitz (JYanowitz at enovafinancial dot com) for
279
- the patch.
280
-
281
-
282
- == v0.10.1 [2011-01-19] Michael Granger <ged@FaerieMUD.org>
283
-
284
- Bugfixes:
285
-
286
- * Add an include guard for pg.h
287
- * Simplify the common case require of the ext
288
- * Include the extconf header
289
- * Fix compatibility with versions of PostgreSQL without PQgetCancel. (fixes #36)
290
- * Fix require for natively-compiled extension under Windows. (fixes #55)
291
- * Change rb_yield_splat() to rb_yield_values() for compatibility with Rubinius. (fixes #54)
292
-
293
-
294
- == v0.10.0 [2010-12-01] Michael Granger <ged@FaerieMUD.org>
295
-
296
- Enhancements:
297
-
298
- * Added support for the payload of NOTIFY events (w/Mahlon E. Smith)
299
- * Updated the build system with Rubygems suggestions from RubyConf 2010
300
-
301
- Bugfixes:
302
-
303
- * Fixed issue with PGconn#wait_for_notify that caused it to miss notifications that happened after
304
- the LISTEN but before the wait_for_notify.
305
-
306
- == v0.9.0 [2010-02-28] Michael Granger <ged@FaerieMUD.org>
307
-
308
- Bugfixes.
309
-
310
- == v0.8.0 [2009-03-28] Jeff Davis <davis.jeffrey@gmail.com>
311
-
312
- Bugfixes, better Windows support.
313
-
data/README.ja.rdoc DELETED
@@ -1,14 +0,0 @@
1
- = pg
2
-
3
- home :: https://bitbucket.org/ged/ruby-pg
4
- mirror :: https://github.com/ged/ruby-pg
5
- docs :: http://deveiate.org/code/pg
6
-
7
-
8
- == Description
9
-
10
- This file needs a translation of the English README. Pull requests, patches, or
11
- volunteers gladly accepted.
12
-
13
- Until such time, please accept my sincere apologies for not knowing Japanese.
14
-
data/README.rdoc DELETED
@@ -1,161 +0,0 @@
1
- = pg
2
-
3
- home :: https://bitbucket.org/ged/ruby-pg
4
- mirror :: https://github.com/ged/ruby-pg
5
- docs :: http://deveiate.org/code/pg
6
-
7
-
8
- == Description
9
-
10
- Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
11
-
12
- It works with {PostgreSQL 8.4 and later}[http://www.postgresql.org/support/versioning/].
13
-
14
- A small example usage:
15
-
16
- #!/usr/bin/env ruby
17
-
18
- require 'pg'
19
-
20
- # Output a table of current connections to the DB
21
- conn = PG.connect( dbname: 'sales' )
22
- conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
23
- puts " PID | User | Query"
24
- result.each do |row|
25
- puts " %7d | %-16s | %s " %
26
- row.values_at('procpid', 'usename', 'current_query')
27
- end
28
- end
29
-
30
- == Build Status
31
-
32
- {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ged/ruby-pg]
33
-
34
-
35
- == Requirements
36
-
37
- * Ruby 1.9.3-p392, or 2.0.0-p0.
38
- * PostgreSQL 8.4.x or later (with headers, -dev packages, etc).
39
-
40
- It may work with earlier versions of Ruby/PostgreSQL as well, but those are
41
- not regularly tested.
42
-
43
-
44
- == How To Install
45
-
46
- Install via RubyGems:
47
-
48
- gem install pg
49
-
50
- You may need to specify the path to the 'pg_config' program installed with
51
- Postgres:
52
-
53
- gem install pg -- --with-pg-config=<path to pg_config>
54
-
55
- If you're installing via Bundler, you can provide compile hints like so:
56
-
57
- bundle config build.pg --with-pg-config=<path to pg_config>
58
-
59
- See README-OS_X.rdoc for more information about installing under MacOS X, and
60
- README-Windows.rdoc for Windows build/installation instructions.
61
-
62
- There's also {a Google+ group}[http://goo.gl/TFy1U] and a
63
- {mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
64
- want to chat about something.
65
-
66
-
67
- == Type Casts
68
-
69
- Pg can optionally type cast result values and query parameters in Ruby or
70
- native C code. This can speed up data transfers to and from the database,
71
- because String allocations are reduced and conversions in (slower) Ruby code
72
- can be omitted.
73
-
74
- Very basic type casting can be enabled by:
75
-
76
- conn.type_map_for_results = PG::BasicTypeMapForResults.new conn
77
- # ... this works for result value mapping:
78
- conn.exec("select 1, now(), '{2,3}'::int[]").values
79
- # => [[1, 2014-09-21 20:51:56 +0200, [2, 3]]]
80
-
81
- conn.type_map_for_queries = PG::BasicTypeMapForQueries.new conn
82
- # ... and this for param value mapping:
83
- conn.exec_params("SELECT $1::text, $2::text, $3::text", [1, 1.23, [2,3]]).values
84
- # => [["1", "1.2300000000000000E+00", "{2,3}"]]
85
-
86
- But Pg's type casting is highly customizable. That's why it's divided into
87
- 2 layers:
88
-
89
- === Encoders / Decoders (ext/pg_*coder.c, lib/pg/*coder.rb)
90
-
91
- This is the lower layer, containing encoding classes that convert Ruby
92
- objects for transmission to the DBMS and decoding classes to convert
93
- received data back to Ruby objects. The classes are namespaced according
94
- to their format and direction in PG::TextEncoder, PG::TextDecoder,
95
- PG::BinaryEncoder and PG::BinaryDecoder.
96
-
97
- It is possible to assign a type OID, format code (text or binary) and
98
- optionally a name to an encoder or decoder object. It's also possible
99
- to build composite types by assigning an element encoder/decoder.
100
- PG::Coder objects can be used to set up a PG::TypeMap or alternatively
101
- to convert single values to/from their string representation.
102
-
103
- === PG::TypeMap and derivations (ext/pg_type_map*.c, lib/pg/type_map*.rb)
104
-
105
- A TypeMap defines which value will be converted by which encoder/decoder.
106
- There are different type map strategies, implemented by several derivations
107
- of this class. They can be chosen and configured according to the particular
108
- needs for type casting. The default type map is PG::TypeMapAllStrings.
109
-
110
- A type map can be assigned per connection or per query respectively per
111
- result set. Type maps can also be used for COPY in and out data streaming.
112
-
113
-
114
- == Contributing
115
-
116
- To report bugs, suggest features, or check out the source with Mercurial,
117
- {check out the project page}[http://bitbucket.org/ged/ruby-pg]. If you prefer
118
- Git, there's also a {Github mirror}[https://github.com/ged/ruby-pg].
119
-
120
- After checking out the source, run:
121
-
122
- $ rake newb
123
-
124
- This task will install any missing dependencies, run the tests/specs, and
125
- generate the API documentation.
126
-
127
- The current maintainers are Michael Granger <ged@FaerieMUD.org> and
128
- Lars Kanis <lars@greiz-reinsdorf.de>.
129
-
130
-
131
- == Copying
132
-
133
- Copyright (c) 1997-2015 by the authors.
134
-
135
- * Jeff Davis <ruby-pg@j-davis.com>
136
- * Guy Decoux (ts) <decoux@moulon.inra.fr>
137
- * Michael Granger <ged@FaerieMUD.org>
138
- * Lars Kanis <lars@greiz-reinsdorf.de>
139
- * Dave Lee
140
- * Eiji Matsumoto <usagi@ruby.club.or.jp>
141
- * Yukihiro Matsumoto <matz@ruby-lang.org>
142
- * Noboru Saitou <noborus@netlab.jp>
143
-
144
- You may redistribute this software under the same terms as Ruby itself; see
145
- http://www.ruby-lang.org/en/LICENSE.txt or the LICENSE file in the source
146
- for details.
147
-
148
- Portions of the code are from the PostgreSQL project, and are distributed
149
- under the terms of the PostgreSQL license, included in the file POSTGRES.
150
-
151
- Portions copyright LAIKA, Inc.
152
-
153
-
154
- == Acknowledgments
155
-
156
- See Contributors.rdoc for the many additional fine people that have contributed
157
- to this library over the years.
158
-
159
- We are thankful to the people at the ruby-list and ruby-dev mailing lists.
160
- And to the people who developed PostgreSQL.
161
-