pg 0.18.0.pre20141117110243-x86-mingw32 → 0.18.0-x86-mingw32
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 +1 -3
- data.tar.gz.sig +1 -2
- data/ChangeLog +294 -1
- data/History.rdoc +2 -1
- data/Manifest.txt +3 -1
- data/Rakefile +17 -0
- data/ext/pg.c +1 -0
- data/ext/pg.h +1 -0
- data/ext/pg_connection.c +4 -4
- data/ext/pg_copy_coder.c +24 -4
- data/ext/pg_text_decoder.c +2 -4
- data/ext/pg_text_encoder.c +27 -38
- data/ext/pg_type_map.c +0 -25
- data/ext/pg_type_map_all_strings.c +1 -1
- data/ext/pg_type_map_by_oid.c +7 -25
- data/ext/pg_type_map_in_ruby.c +302 -0
- data/lib/1.9/pg_ext.so +0 -0
- data/lib/2.0/pg_ext.so +0 -0
- data/lib/2.1/pg_ext.so +0 -0
- data/lib/2.2/pg_ext.so +0 -0
- data/lib/i386-mingw32/libpq.dll +0 -0
- data/lib/pg.rb +1 -1
- data/lib/pg/basic_type_mapping.rb +25 -3
- data/lib/pg/connection.rb +1 -1
- data/spec/pg/basic_type_mapping_spec.rb +3 -3
- data/spec/pg/type_map_by_class_spec.rb +1 -1
- data/spec/pg/type_map_by_oid_spec.rb +1 -6
- data/spec/pg/type_map_in_ruby_spec.rb +164 -0
- data/spec/pg/type_map_spec.rb +0 -17
- data/spec/pg/type_spec.rb +5 -9
- metadata +9 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 775c804f90ec512db94e146a098f156678922770
|
4
|
+
data.tar.gz: 922050d887d35dd25178eff5ffe47dab33be5722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f97bc5b2cc87eaf4f591f983ef72f80bb5e246dfb414e27012032b972a2070391fd7b65ef3df8e57245e9f9376f21ec97489bed8b6b43fc2fc01583af01bf1a8
|
7
|
+
data.tar.gz: 4aa5f243d1b58d1a0c1b785191adb6d93390045afa06ccf2ce379226bed2a8905d690bd47014e90d232dc03b5edabd226c219f950aaaff02cd270d7ba7f74103
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
OsA�9� 5�~�D6���dp�֠��g�6����dS�~������ޘ�+|>sք2����l�V�LL�|�;��?���I�yd@[�s��&���9Ax{X�"M�9��+B~9��Y�g5�Р-���۹X_o?��x4I }C�0�BX�����o��:$W��m~��HY��c)9�W��S�[*s4/;�!�9�ţ����Q���0v���
|
3
|
-
��+6����1� �
|
1
|
+
J�f ̪"2�:�3��If/��a���A�f!����<��N�|����;)�����9��~��"h"2���e���؏V�b��]�3��Ȣ�﹙�Z8�?�Q�S*�/�_� �Ĉ��:r�%��Y�1���j7��C��S�F���+��V����ֺ�YD�����Vr�N�?����kg�Y &����gM�db�\��&O���v d����9b٘�/ün k�ܰ�tG"�BF�C��qq����
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
���u�F���%'x����?o�BEJ��z%�CH�kf��̀��wl�rb�K�Dɍ~�n�.�<��'d`[*T��ߍ��X7��.���|μ��I
|
1
|
+
Ko~�<��k$���<�%��������%��ޓ챢��+m��|�����=�)%�@��`�KV����c�*��ᖞF68�=�^Qz@7-}K��/#Dw
|
data/ChangeLog
CHANGED
@@ -1,8 +1,301 @@
|
|
1
|
+
2015-01-03 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* .hgtags:
|
4
|
+
Added tag v0.18.0 for changeset cfb2bfc0f661
|
5
|
+
[8aff3973f2d2] [tip]
|
6
|
+
|
7
|
+
* .hgsigs:
|
8
|
+
Added signature for changeset c519766e3ec9
|
9
|
+
[cfb2bfc0f661] [v0.18.0]
|
10
|
+
|
11
|
+
* History.rdoc:
|
12
|
+
Update the History
|
13
|
+
[c519766e3ec9]
|
14
|
+
|
15
|
+
* Manifest.txt:
|
16
|
+
Keep the manifest sorted so it can be diffed.
|
17
|
+
[d7cdbfd1b516]
|
18
|
+
|
19
|
+
* Rakefile:
|
20
|
+
Add a Rake task for generating the gemspec
|
21
|
+
[ec6d6ce61a15]
|
22
|
+
|
23
|
+
2014-12-26 Lars Kanis <lars@greiz-reinsdorf.de>
|
24
|
+
|
25
|
+
* lib/pg/basic_type_mapping.rb:
|
26
|
+
Add a warning about Type OIDs without decoder in
|
27
|
+
PG::BasicTypeMapForResults.
|
28
|
+
[592e29cdf2e9]
|
29
|
+
|
30
|
+
2014-12-13 Lars Kanis <lars@greiz-reinsdorf.de>
|
31
|
+
|
32
|
+
* ext/pg_type_map_in_ruby.c:
|
33
|
+
Fix TypeMapInRuby for Rubinius.
|
34
|
+
[a38cf53a96f1]
|
35
|
+
|
36
|
+
2014-12-12 Lars Kanis <lars@greiz-reinsdorf.de>
|
37
|
+
|
38
|
+
* ext/pg_type_map_all_strings.c:
|
39
|
+
Fix documentation to TypeMapAllStrings.
|
40
|
+
[c53f993a4254]
|
41
|
+
|
42
|
+
* Manifest.txt, ext/pg.c, ext/pg.h, ext/pg_type_map_in_ruby.c,
|
43
|
+
spec/pg/type_map_in_ruby_spec.rb:
|
44
|
+
Add TypeMapInRuby as a way to combine fast but static C-based type
|
45
|
+
maps with flexible ruby based type maps.
|
46
|
+
[a9724aef9116]
|
47
|
+
|
48
|
+
* ext/pg_type_map.c, ext/pg_type_map_by_oid.c,
|
49
|
+
lib/pg/basic_type_mapping.rb, spec/pg/basic_type_mapping_spec.rb,
|
50
|
+
spec/pg/type_map_by_oid_spec.rb, spec/pg/type_map_spec.rb:
|
51
|
+
Remove TypeMap#fit_to_result and #fit_to_query.
|
52
|
+
|
53
|
+
The only use case so far is building a TypeMapByColumn out of a
|
54
|
+
TypeMapByOid, which is now named more explicitly as
|
55
|
+
#build_column_map .
|
56
|
+
[c99d26015e3c]
|
57
|
+
|
58
|
+
* ext/pg_text_encoder.c:
|
59
|
+
Remove unused variable.
|
60
|
+
[1a13e7eafeb7]
|
61
|
+
|
62
|
+
* ext/pg_connection.c, ext/pg_copy_coder.c, lib/pg/connection.rb:
|
63
|
+
Several documentation fixes to COPY coders.
|
64
|
+
[a7befacdef4e]
|
65
|
+
|
66
|
+
2014-11-26 Lars Kanis <lars@greiz-reinsdorf.de>
|
67
|
+
|
68
|
+
* ext/pg_text_encoder.c, spec/pg/type_spec.rb:
|
69
|
+
PG::TextDecoder::Boolean: encode only true, false, 0 and 1 and pass
|
70
|
+
all other values as strings to the server.
|
71
|
+
[6b86a5543567]
|
72
|
+
|
73
|
+
2014-11-24 Lars Kanis <kanis@comcard.de>
|
74
|
+
|
75
|
+
* spec/pg/type_map_by_class_spec.rb:
|
76
|
+
Fix test case for rbx. The error message is somewhat different than
|
77
|
+
in MRI.
|
78
|
+
[99638547f8b4]
|
79
|
+
|
80
|
+
2014-11-21 Lars Kanis <lars@greiz-reinsdorf.de>
|
81
|
+
|
82
|
+
* ext/pg_text_decoder.c:
|
83
|
+
Stack memory can be used for Identifier decoding, since they are
|
84
|
+
limited in size.
|
85
|
+
[b7f9daeeba29]
|
86
|
+
|
87
|
+
2014-11-17 Lars Kanis <kanis@comcard.de>
|
88
|
+
|
89
|
+
* .travis.yml:
|
90
|
+
Revert "Remove Rubinius from the allowed failure list - failing
|
91
|
+
specs are now marked as pending."
|
92
|
+
|
93
|
+
This reverts commit 524c84ccd17f3caeed13a16084206f14225bbdd6 because
|
94
|
+
of ongoing issues with gem installation on rbx.
|
95
|
+
[b8debfea4331]
|
96
|
+
|
97
|
+
2014-10-09 Lars Kanis <kanis@comcard.de>
|
98
|
+
|
99
|
+
* Rakefile, Rakefile.cross, lib/pg.rb:
|
100
|
+
Bundle libpq.dll into gem, because PostgreSQL-9.3 does no longer
|
101
|
+
support static linking.
|
102
|
+
[03fde0fcf77d]
|
103
|
+
|
104
|
+
2014-09-15 Lars Kanis <kanis@comcard.de>
|
105
|
+
|
106
|
+
* ext/pg_type_map_by_column.c:
|
107
|
+
debug travis
|
108
|
+
[b852994b7c48]
|
109
|
+
|
110
|
+
* .travis.yml:
|
111
|
+
debug travis
|
112
|
+
[873dc33ffaf8]
|
113
|
+
|
114
|
+
* .travis.yml:
|
115
|
+
debug travis
|
116
|
+
[49c0557e9034]
|
117
|
+
|
118
|
+
* .travis.yml:
|
119
|
+
Try valgrind
|
120
|
+
[513486ecd1ed]
|
121
|
+
|
122
|
+
2014-01-01 Lars Kanis <lars@greiz-reinsdorf.de>
|
123
|
+
|
124
|
+
* ext/pg.h, ext/pg_column_mapping.c, ext/pg_connection.c,
|
125
|
+
ext/pg_type.c, lib/pg.rb, lib/pg/column_mapping.rb,
|
126
|
+
lib/pg/result.rb, lib/pg/type.rb, spec/pg/column_mapping_spec.rb,
|
127
|
+
spec/pg/result_spec.rb:
|
128
|
+
Add optional type casting to input parameters
|
129
|
+
|
130
|
+
Refactor decoding code
|
131
|
+
[8bdf65103ee0]
|
132
|
+
|
133
|
+
2013-12-28 Lars Kanis <lars@greiz-reinsdorf.de>
|
134
|
+
|
135
|
+
* ext/pg_connection.c:
|
136
|
+
Refactor processing of query params, which was almost equal for
|
137
|
+
exec_params, exec_prepared, send_query and send_query_prepared.
|
138
|
+
[43c5a456205f]
|
139
|
+
|
140
|
+
2013-12-23 Lars Kanis <lars@greiz-reinsdorf.de>
|
141
|
+
|
142
|
+
* ext/pg.h, ext/pg_column_mapping.c, ext/pg_type.c, lib/pg/type.rb,
|
143
|
+
spec/pg/column_mapping_spec.rb, spec/pg/type_spec.rb:
|
144
|
+
Detach type decoders from Result, so that they could be used with
|
145
|
+
COPY.
|
146
|
+
|
147
|
+
Change type encoders to a two pass mechanism, which could also be
|
148
|
+
used with COPY.
|
149
|
+
[c5736f041818]
|
150
|
+
|
151
|
+
2013-12-21 Lars Kanis <lars@greiz-reinsdorf.de>
|
152
|
+
|
153
|
+
* ext/pg_column_mapping.c, ext/pg_type.c:
|
154
|
+
Always map NULL values to Qnil.
|
155
|
+
|
156
|
+
This removes duplicated code from type converters and will speedup
|
157
|
+
converters implemented in ruby.
|
158
|
+
[38cc9de4c7a1]
|
159
|
+
|
160
|
+
2013-12-13 Lars Kanis <lars@greiz-reinsdorf.de>
|
161
|
+
|
162
|
+
* ext/pg.h, ext/pg_column_mapping.c, ext/pg_type.c, lib/pg/result.rb,
|
163
|
+
lib/pg/type.rb, spec/pg/column_mapping_spec.rb,
|
164
|
+
spec/pg/result_spec.rb, spec/pg/type_spec.rb:
|
165
|
+
more WIP: Add bidirectional type mapping
|
166
|
+
[50e50a319f20]
|
167
|
+
|
168
|
+
2013-12-09 Lars Kanis <lars@greiz-reinsdorf.de>
|
169
|
+
|
170
|
+
* Manifest.txt, ext/pg.c, ext/pg.h, ext/pg_column_mapping.c,
|
171
|
+
ext/pg_result.c, ext/pg_type.c, lib/pg.rb, lib/pg/result.rb,
|
172
|
+
lib/pg/type.rb, spec/pg/column_mapping_spec.rb,
|
173
|
+
spec/pg/result_spec.rb, spec/pg/type_spec.rb:
|
174
|
+
WIP: Add bidiractional type mapping
|
175
|
+
[0e58e4d9eecf]
|
176
|
+
|
177
|
+
2013-12-07 Lars Kanis <lars@greiz-reinsdorf.de>
|
178
|
+
|
179
|
+
* lib/pg/result.rb, spec/pg/column_mapping_spec.rb:
|
180
|
+
Add a (quite incomplete) default mapping of OIDs to PG::Result and
|
181
|
+
allow distinct mappings for text and binary formats to
|
182
|
+
Result#map_types! .
|
183
|
+
|
184
|
+
Add documentation to Result#map_types! .
|
185
|
+
[d1730bd948f0]
|
186
|
+
|
187
|
+
2013-07-19 Lars Kanis <kanis@comcard.de>
|
188
|
+
|
189
|
+
* spec/pg/column_mapping_spec.rb:
|
190
|
+
Too less quoting. Should fix compat with PostgreSQL 8.4.
|
191
|
+
[8c91b4b51b2f]
|
192
|
+
|
193
|
+
2013-07-18 Lars Kanis <kanis@comcard.de>
|
194
|
+
|
195
|
+
* Manifest.txt:
|
196
|
+
Add missing files to Manifest.txt.
|
197
|
+
[d708f0452cd9]
|
198
|
+
|
199
|
+
* Manifest.txt, ext/pg_column_mapping.c, ext/util.c, ext/util.h:
|
200
|
+
Add compat with Windows platform.
|
201
|
+
[a3d5773fbb0d]
|
202
|
+
|
203
|
+
* ext/pg_column_mapping.c, spec/pg/column_mapping_spec.rb:
|
204
|
+
Add compat with Ruby-1.8.7.
|
205
|
+
[1c03dc9752f2]
|
206
|
+
|
207
|
+
* spec/pg/column_mapping_spec.rb:
|
208
|
+
Use old BYTEA escaping for compat with PostgreSQL 8.4
|
209
|
+
[4ff19d752977]
|
210
|
+
|
211
|
+
2013-07-04 Lars Kanis <lars@greiz-reinsdorf.de>
|
212
|
+
|
213
|
+
* ext/pg_column_mapping.c, spec/pg/column_mapping_spec.rb:
|
214
|
+
Add BinaryBolean converter.
|
215
|
+
|
216
|
+
Refactor converter tests.
|
217
|
+
[6e769d602e2b]
|
218
|
+
|
219
|
+
* ext/pg_column_mapping.c, spec/pg/column_mapping_spec.rb:
|
220
|
+
Add BinaryFloat converter.
|
221
|
+
[aad7bf30c9af]
|
222
|
+
|
223
|
+
2013-07-03 Lars Kanis <lars@greiz-reinsdorf.de>
|
224
|
+
|
225
|
+
* ext/pg_column_mapping.c, lib/pg/result.rb,
|
226
|
+
spec/pg/column_mapping_spec.rb, spec/pg/result_spec.rb:
|
227
|
+
Change ColumnMapping#initialize to take one Array arg rather than a
|
228
|
+
parameter list.
|
229
|
+
|
230
|
+
Suggested by Aaron: https://groups.google.com/d/msg/ruby-
|
231
|
+
pg/PE5K6q9RzBs/M5prOno39DEJ
|
232
|
+
[9942faf0a523]
|
233
|
+
|
234
|
+
* spec/pg/result_spec.rb:
|
235
|
+
Add test case for all value retrieving methods of PG::Result .
|
236
|
+
[36ab9306a585]
|
237
|
+
|
238
|
+
* spec/pg/column_mapping_spec.rb:
|
239
|
+
Add test case for default_mapping in Result#map_types!
|
240
|
+
[3a7397c537b8]
|
241
|
+
|
242
|
+
* lib/pg/result.rb, spec/pg/column_mapping_spec.rb:
|
243
|
+
Add convenience method PG::Result#map_types!
|
244
|
+
[2f4da696145e]
|
245
|
+
|
246
|
+
* spec/pg/column_mapping_spec.rb:
|
247
|
+
Add Boolean ColumnMapping spec and do Integer a bit more compact.
|
248
|
+
[5391bdaaf012]
|
249
|
+
|
250
|
+
2013-07-01 Lars Kanis <kanis@comcard.de>
|
251
|
+
|
252
|
+
* ext/pg_column_mapping.c, spec/pg/column_mapping_spec.rb:
|
253
|
+
Add converter BinaryInteger.
|
254
|
+
[127523ca99c0]
|
255
|
+
|
256
|
+
* ext/pg_column_mapping.c, spec/pg/column_mapping_spec.rb,
|
257
|
+
spec/pg/result_spec.rb:
|
258
|
+
Use instances of PG::ColumnMapping::CConverter as representation of
|
259
|
+
the buildin converters instead of plain symbols. Symbol arguments
|
260
|
+
are converted to these instances, for convenience.
|
261
|
+
|
262
|
+
This allows to store and retrieve additional informations to the
|
263
|
+
conversion and also which conversions are supported.
|
264
|
+
[7a5076617b9a]
|
265
|
+
|
266
|
+
* ext/pg_column_mapping.c:
|
267
|
+
Don't depend on TYPE(obj)==T_DATA of a proc object for compat with
|
268
|
+
rubinius.
|
269
|
+
[7cafcdbfe515]
|
270
|
+
|
271
|
+
2013-06-29 Lars Kanis <lars@greiz-reinsdorf.de>
|
272
|
+
|
273
|
+
* ext/pg.c, ext/pg.h, ext/pg_column_mapping.c, ext/pg_result.c,
|
274
|
+
spec/pg/result_spec.rb:
|
275
|
+
Add column based type mapping.
|
276
|
+
|
277
|
+
This allowes to speed up result retrieval by directly converting
|
278
|
+
integer and float values to proper ruby types.
|
279
|
+
[bd7789f8f3c4]
|
280
|
+
|
281
|
+
2014-11-17 Lars Kanis <kanis@comcard.de>
|
282
|
+
|
283
|
+
* ext/pg.h, ext/pg_errors.c, ext/pg_result.c, spec/pg/result_spec.rb:
|
284
|
+
Use dedicated error classes for stream exceptions.
|
285
|
+
[f23dd01bcb52]
|
286
|
+
|
287
|
+
* History.rdoc, ext/pg.c, spec/pg_spec.rb:
|
288
|
+
Add PG.init_openssl and PG.init_ssl methods.
|
289
|
+
|
290
|
+
This will hopefully help to solve issue #190:
|
291
|
+
https://bitbucket.org/ged/ruby-pg/issue/190
|
292
|
+
[45610159a246]
|
293
|
+
|
1
294
|
2014-11-10 Lars Kanis <lars@greiz-reinsdorf.de>
|
2
295
|
|
3
296
|
* ext/pg_type_map_by_class.c:
|
4
297
|
Fix typo.
|
5
|
-
[eeb8a82c5328]
|
298
|
+
[eeb8a82c5328]
|
6
299
|
|
7
300
|
* spec/pg/type_map_by_class_spec.rb:
|
8
301
|
TypeMapByClass: Add test for invlid coder object.
|
data/History.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
== v0.18.0 [
|
1
|
+
== v0.18.0 [2015-01-01] Michael Granger <ged@FaerieMUD.org>
|
2
2
|
|
3
3
|
Bugfixes:
|
4
4
|
- Fix OID to Integer mapping (it is unsigned now). #187
|
@@ -19,6 +19,7 @@ Enhancements:
|
|
19
19
|
- Update Windows cross build to PostgreSQL 9.3.
|
20
20
|
|
21
21
|
|
22
|
+
|
22
23
|
== v0.17.1 [2013-12-18] Michael Granger <ged@FaerieMUD.org>
|
23
24
|
|
24
25
|
Bugfixes:
|
data/Manifest.txt
CHANGED
@@ -29,12 +29,13 @@ ext/pg_errors.c
|
|
29
29
|
ext/pg_result.c
|
30
30
|
ext/pg_text_decoder.c
|
31
31
|
ext/pg_text_encoder.c
|
32
|
+
ext/pg_type_map.c
|
32
33
|
ext/pg_type_map_all_strings.c
|
33
34
|
ext/pg_type_map_by_class.c
|
34
35
|
ext/pg_type_map_by_column.c
|
35
36
|
ext/pg_type_map_by_mri_type.c
|
36
37
|
ext/pg_type_map_by_oid.c
|
37
|
-
ext/
|
38
|
+
ext/pg_type_map_in_ruby.c
|
38
39
|
ext/util.c
|
39
40
|
ext/util.h
|
40
41
|
ext/vc/pg.sln
|
@@ -78,6 +79,7 @@ spec/pg/type_map_by_class_spec.rb
|
|
78
79
|
spec/pg/type_map_by_column_spec.rb
|
79
80
|
spec/pg/type_map_by_mri_type_spec.rb
|
80
81
|
spec/pg/type_map_by_oid_spec.rb
|
82
|
+
spec/pg/type_map_in_ruby_spec.rb
|
81
83
|
spec/pg/type_map_spec.rb
|
82
84
|
spec/pg/type_spec.rb
|
83
85
|
spec/pg_spec.rb
|
data/Rakefile
CHANGED
@@ -29,6 +29,8 @@ TMPDIR = BASEDIR + 'tmp'
|
|
29
29
|
DLEXT = RbConfig::CONFIG['DLEXT']
|
30
30
|
EXT = LIBDIR + "pg_ext.#{DLEXT}"
|
31
31
|
|
32
|
+
GEMSPEC = 'pg.gemspec'
|
33
|
+
|
32
34
|
TEST_DIRECTORY = BASEDIR + "tmp_test_specs"
|
33
35
|
|
34
36
|
CLOBBER.include( TEST_DIRECTORY.to_s )
|
@@ -187,3 +189,18 @@ file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
|
|
187
189
|
# trigger compilation of changed errorcodes.def
|
188
190
|
touch 'ext/pg_errors.c'
|
189
191
|
end
|
192
|
+
|
193
|
+
task :gemspec => GEMSPEC
|
194
|
+
file GEMSPEC => __FILE__
|
195
|
+
task GEMSPEC do |task|
|
196
|
+
spec = $hoespec.spec
|
197
|
+
spec.files.delete( '.gemtest' )
|
198
|
+
spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
199
|
+
File.open( task.name, 'w' ) do |fh|
|
200
|
+
fh.write( spec.to_ruby )
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
CLOBBER.include( GEMSPEC.to_s )
|
205
|
+
task :default => :gemspec
|
206
|
+
|
data/ext/pg.c
CHANGED
data/ext/pg.h
CHANGED
@@ -302,6 +302,7 @@ void init_pg_type_map_by_class _(( void ));
|
|
302
302
|
void init_pg_type_map_by_column _(( void ));
|
303
303
|
void init_pg_type_map_by_mri_type _(( void ));
|
304
304
|
void init_pg_type_map_by_oid _(( void ));
|
305
|
+
void init_pg_type_map_in_ruby _(( void ));
|
305
306
|
void init_pg_coder _(( void ));
|
306
307
|
void init_pg_copycoder _(( void ));
|
307
308
|
void init_pg_text_encoder _(( void ));
|
data/ext/pg_connection.c
CHANGED
@@ -2542,10 +2542,10 @@ pgconn_wait_for_notify(int argc, VALUE *argv, VALUE self)
|
|
2542
2542
|
* not sent (false is only possible if the connection
|
2543
2543
|
* is in nonblocking mode, and this command would block).
|
2544
2544
|
*
|
2545
|
-
* encoder can be a PG::Coder derivation (typically PG::
|
2545
|
+
* encoder can be a PG::Coder derivation (typically PG::TextEncoder::CopyRow).
|
2546
2546
|
* This encodes the received data fields from an Array of Strings. Optionally
|
2547
2547
|
* the encoder can type cast the fields form various Ruby types in one step,
|
2548
|
-
* if PG::
|
2548
|
+
* if PG::TextEncoder::CopyRow#type_map is set accordingly.
|
2549
2549
|
*
|
2550
2550
|
* Raises an exception if an error occurs.
|
2551
2551
|
*
|
@@ -2654,10 +2654,10 @@ pgconn_put_copy_end(int argc, VALUE *argv, VALUE self)
|
|
2654
2654
|
* if the copy is done, or +false+ if the call would
|
2655
2655
|
* block (only possible if _async_ is true).
|
2656
2656
|
*
|
2657
|
-
* decoder can be a PG::Coder derivation (typically PG::
|
2657
|
+
* decoder can be a PG::Coder derivation (typically PG::TextDecoder::CopyRow).
|
2658
2658
|
* This decodes the received data fields as Array of Strings. Optionally
|
2659
2659
|
* the decoder can type cast the fields to various Ruby types in one step,
|
2660
|
-
* if PG::
|
2660
|
+
* if PG::TextDecoder::CopyRow#type_map is set accordingly.
|
2661
2661
|
*
|
2662
2662
|
* See also #copy_data.
|
2663
2663
|
*
|
data/ext/pg_copy_coder.c
CHANGED
@@ -153,12 +153,20 @@ pg_copycoder_type_map_get(VALUE self)
|
|
153
153
|
* See the {COPY command}[http://www.postgresql.org/docs/current/static/sql-copy.html]
|
154
154
|
* for description of the format.
|
155
155
|
*
|
156
|
-
* It is intended to be used in conjunction with PG::Connection#
|
156
|
+
* It is intended to be used in conjunction with PG::Connection#put_copy_data .
|
157
157
|
*
|
158
158
|
* The columns are expected as Array of values. The single values are encoded as defined
|
159
159
|
* in the assigned #type_map. If no type_map was assigned, all values are converted to
|
160
|
-
*
|
160
|
+
* strings by PG::TextEncoder::String.
|
161
161
|
*
|
162
|
+
* Example with default type map ( TypeMapAllStrings ):
|
163
|
+
* conn.exec "create table my_table (a text,b int,c bool)"
|
164
|
+
* enco = PG::TextEncoder::CopyRow.new
|
165
|
+
* conn.copy_data "COPY my_table FROM STDIN", enco do
|
166
|
+
* conn.put_copy_data ["astring", 7, false]
|
167
|
+
* conn.put_copy_data ["string2", 42, true]
|
168
|
+
* end
|
169
|
+
* This creates +my_table+ and inserts two rows.
|
162
170
|
*/
|
163
171
|
static int
|
164
172
|
pg_text_enc_copy_row(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
@@ -286,12 +294,22 @@ GetDecimalFromHex(char hex)
|
|
286
294
|
* See the {COPY command}[http://www.postgresql.org/docs/current/static/sql-copy.html]
|
287
295
|
* for description of the format.
|
288
296
|
*
|
289
|
-
* It is intended to be used in conjunction with PG::Connection#
|
297
|
+
* It is intended to be used in conjunction with PG::Connection#get_copy_data .
|
290
298
|
*
|
291
299
|
* The columns are retrieved as Array of values. The single values are decoded as defined
|
292
300
|
* in the assigned #type_map. If no type_map was assigned, all values are converted to
|
293
|
-
*
|
301
|
+
* strings by PG::TextDecoder::String.
|
294
302
|
*
|
303
|
+
* Example with default type map ( TypeMapAllStrings ):
|
304
|
+
* deco = PG::TextDecoder::CopyRow.new
|
305
|
+
* conn.copy_data "COPY my_table TO STDOUT", deco do
|
306
|
+
* while row=conn.get_copy_data
|
307
|
+
* p row
|
308
|
+
* end
|
309
|
+
* end
|
310
|
+
* This prints all rows of +my_table+ to stdout:
|
311
|
+
* ["astring", "7", "f"]
|
312
|
+
* ["string2", "42", "t"]
|
295
313
|
*/
|
296
314
|
/*
|
297
315
|
* Parse the current line into separate attributes (fields),
|
@@ -534,8 +552,10 @@ init_pg_copycoder()
|
|
534
552
|
rb_define_alloc_func( rb_cPG_CopyDecoder, pg_copycoder_decoder_allocate );
|
535
553
|
|
536
554
|
/* Make RDoc aware of the encoder classes... */
|
555
|
+
/* rb_mPG_TextEncoder = rb_define_module_under( rb_mPG, "TextEncoder" ); */
|
537
556
|
/* dummy = rb_define_class_under( rb_mPG_TextEncoder, "CopyRow", rb_cPG_CopyEncoder ); */
|
538
557
|
pg_define_coder( "CopyRow", pg_text_enc_copy_row, rb_cPG_CopyEncoder, rb_mPG_TextEncoder );
|
558
|
+
/* rb_mPG_TextDecoder = rb_define_module_under( rb_mPG, "TextDecoder" ); */
|
539
559
|
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "CopyRow", rb_cPG_CopyDecoder ); */
|
540
560
|
pg_define_coder( "CopyRow", pg_text_dec_copy_row, rb_cPG_CopyDecoder, rb_mPG_TextDecoder );
|
541
561
|
}
|