pg 0.21.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/.appveyor.yml +36 -0
  4. data/.gems +6 -0
  5. data/.github/workflows/binary-gems.yml +86 -0
  6. data/.github/workflows/source-gem.yml +130 -0
  7. data/.gitignore +13 -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/Gemfile +14 -0
  15. data/History.rdoc +291 -4
  16. data/Manifest.txt +8 -4
  17. data/README-Windows.rdoc +4 -4
  18. data/README.ja.rdoc +1 -2
  19. data/README.rdoc +62 -16
  20. data/Rakefile +32 -142
  21. data/Rakefile.cross +69 -71
  22. data/certs/ged.pem +24 -0
  23. data/certs/larskanis-2022.pem +26 -0
  24. data/ext/errorcodes.def +84 -0
  25. data/ext/errorcodes.rb +1 -1
  26. data/ext/errorcodes.txt +23 -2
  27. data/ext/extconf.rb +109 -52
  28. data/ext/gvl_wrappers.c +8 -0
  29. data/ext/gvl_wrappers.h +40 -33
  30. data/ext/pg.c +211 -146
  31. data/ext/pg.h +85 -95
  32. data/ext/pg_binary_decoder.c +82 -15
  33. data/ext/pg_binary_encoder.c +13 -12
  34. data/ext/pg_coder.c +145 -30
  35. data/ext/pg_connection.c +1349 -929
  36. data/ext/pg_copy_coder.c +60 -23
  37. data/ext/pg_record_coder.c +519 -0
  38. data/ext/pg_result.c +613 -207
  39. data/ext/pg_text_decoder.c +606 -40
  40. data/ext/pg_text_encoder.c +190 -59
  41. data/ext/pg_tuple.c +575 -0
  42. data/ext/pg_type_map.c +42 -9
  43. data/ext/pg_type_map_all_strings.c +19 -5
  44. data/ext/pg_type_map_by_class.c +54 -24
  45. data/ext/pg_type_map_by_column.c +73 -34
  46. data/ext/pg_type_map_by_mri_type.c +48 -19
  47. data/ext/pg_type_map_by_oid.c +55 -25
  48. data/ext/pg_type_map_in_ruby.c +51 -20
  49. data/ext/{util.c → pg_util.c} +12 -12
  50. data/ext/{util.h → pg_util.h} +2 -2
  51. data/lib/pg/basic_type_map_based_on_result.rb +47 -0
  52. data/lib/pg/basic_type_map_for_queries.rb +193 -0
  53. data/lib/pg/basic_type_map_for_results.rb +81 -0
  54. data/lib/pg/basic_type_registry.rb +296 -0
  55. data/lib/pg/binary_decoder.rb +23 -0
  56. data/lib/pg/coder.rb +24 -3
  57. data/lib/pg/connection.rb +600 -46
  58. data/lib/pg/constants.rb +2 -1
  59. data/lib/pg/exceptions.rb +2 -1
  60. data/lib/pg/result.rb +14 -2
  61. data/lib/pg/text_decoder.rb +21 -26
  62. data/lib/pg/text_encoder.rb +32 -8
  63. data/lib/pg/tuple.rb +30 -0
  64. data/lib/pg/type_map_by_column.rb +3 -2
  65. data/lib/pg/version.rb +4 -0
  66. data/lib/pg.rb +51 -38
  67. data/misc/openssl-pg-segfault.rb +31 -0
  68. data/misc/postgres/History.txt +9 -0
  69. data/misc/postgres/Manifest.txt +5 -0
  70. data/misc/postgres/README.txt +21 -0
  71. data/misc/postgres/Rakefile +21 -0
  72. data/misc/postgres/lib/postgres.rb +16 -0
  73. data/misc/ruby-pg/History.txt +9 -0
  74. data/misc/ruby-pg/Manifest.txt +5 -0
  75. data/misc/ruby-pg/README.txt +21 -0
  76. data/misc/ruby-pg/Rakefile +21 -0
  77. data/misc/ruby-pg/lib/ruby/pg.rb +16 -0
  78. data/pg.gemspec +32 -0
  79. data/sample/array_insert.rb +20 -0
  80. data/sample/async_api.rb +106 -0
  81. data/sample/async_copyto.rb +39 -0
  82. data/sample/async_mixed.rb +56 -0
  83. data/sample/check_conn.rb +21 -0
  84. data/sample/copydata.rb +71 -0
  85. data/sample/copyfrom.rb +81 -0
  86. data/sample/copyto.rb +19 -0
  87. data/sample/cursor.rb +21 -0
  88. data/sample/disk_usage_report.rb +177 -0
  89. data/sample/issue-119.rb +94 -0
  90. data/sample/losample.rb +69 -0
  91. data/sample/minimal-testcase.rb +17 -0
  92. data/sample/notify_wait.rb +72 -0
  93. data/sample/pg_statistics.rb +285 -0
  94. data/sample/replication_monitor.rb +222 -0
  95. data/sample/test_binary_values.rb +33 -0
  96. data/sample/wal_shipper.rb +434 -0
  97. data/sample/warehouse_partitions.rb +311 -0
  98. data.tar.gz.sig +0 -0
  99. metadata +96 -229
  100. metadata.gz.sig +0 -0
  101. data/ChangeLog +0 -6595
  102. data/lib/pg/basic_type_mapping.rb +0 -426
  103. data/lib/pg/deprecated_constants.rb +0 -21
  104. data/spec/data/expected_trace.out +0 -26
  105. data/spec/data/random_binary_data +0 -0
  106. data/spec/helpers.rb +0 -352
  107. data/spec/pg/basic_type_mapping_spec.rb +0 -305
  108. data/spec/pg/connection_spec.rb +0 -1676
  109. data/spec/pg/result_spec.rb +0 -456
  110. data/spec/pg/type_map_by_class_spec.rb +0 -138
  111. data/spec/pg/type_map_by_column_spec.rb +0 -222
  112. data/spec/pg/type_map_by_mri_type_spec.rb +0 -136
  113. data/spec/pg/type_map_by_oid_spec.rb +0 -149
  114. data/spec/pg/type_map_in_ruby_spec.rb +0 -164
  115. data/spec/pg/type_map_spec.rb +0 -22
  116. data/spec/pg/type_spec.rb +0 -777
  117. data/spec/pg_spec.rb +0 -50
data/ext/pg_coder.c CHANGED
@@ -26,11 +26,11 @@ pg_coder_allocate( VALUE klass )
26
26
  void
27
27
  pg_coder_init_encoder( VALUE self )
28
28
  {
29
- t_pg_coder *this = DATA_PTR( self );
29
+ t_pg_coder *this = RTYPEDDATA_DATA( self );
30
30
  VALUE klass = rb_class_of(self);
31
31
  if( rb_const_defined( klass, s_id_CFUNC ) ){
32
32
  VALUE cfunc = rb_const_get( klass, s_id_CFUNC );
33
- this->enc_func = DATA_PTR(cfunc);
33
+ this->enc_func = RTYPEDDATA_DATA(cfunc);
34
34
  } else {
35
35
  this->enc_func = NULL;
36
36
  }
@@ -38,41 +38,97 @@ pg_coder_init_encoder( VALUE self )
38
38
  this->coder_obj = self;
39
39
  this->oid = 0;
40
40
  this->format = 0;
41
+ this->flags = 0;
41
42
  rb_iv_set( self, "@name", Qnil );
42
43
  }
43
44
 
44
45
  void
45
46
  pg_coder_init_decoder( VALUE self )
46
47
  {
47
- t_pg_coder *this = DATA_PTR( self );
48
+ t_pg_coder *this = RTYPEDDATA_DATA( self );
48
49
  VALUE klass = rb_class_of(self);
49
50
  this->enc_func = NULL;
50
51
  if( rb_const_defined( klass, s_id_CFUNC ) ){
51
52
  VALUE cfunc = rb_const_get( klass, s_id_CFUNC );
52
- this->dec_func = DATA_PTR(cfunc);
53
+ this->dec_func = RTYPEDDATA_DATA(cfunc);
53
54
  } else {
54
55
  this->dec_func = NULL;
55
56
  }
56
57
  this->coder_obj = self;
57
58
  this->oid = 0;
58
59
  this->format = 0;
60
+ this->flags = 0;
59
61
  rb_iv_set( self, "@name", Qnil );
60
62
  }
61
63
 
64
+ static size_t
65
+ pg_coder_memsize(const void *_this)
66
+ {
67
+ const t_pg_coder *this = (const t_pg_coder *)_this;
68
+ return sizeof(*this);
69
+ }
70
+
71
+ static size_t
72
+ pg_composite_coder_memsize(const void *_this)
73
+ {
74
+ const t_pg_composite_coder *this = (const t_pg_composite_coder *)_this;
75
+ return sizeof(*this);
76
+ }
77
+
78
+ void
79
+ pg_coder_compact(void *_this)
80
+ {
81
+ t_pg_coder *this = (t_pg_coder *)_this;
82
+ pg_gc_location(this->coder_obj);
83
+ }
84
+
85
+ static void
86
+ pg_composite_coder_compact(void *_this)
87
+ {
88
+ t_pg_composite_coder *this = (t_pg_composite_coder *)_this;
89
+ pg_coder_compact(&this->comp);
90
+ }
91
+
92
+ const rb_data_type_t pg_coder_type = {
93
+ "PG::Coder",
94
+ {
95
+ (RUBY_DATA_FUNC) NULL,
96
+ RUBY_TYPED_DEFAULT_FREE,
97
+ pg_coder_memsize,
98
+ pg_compact_callback(pg_coder_compact),
99
+ },
100
+ 0,
101
+ 0,
102
+ RUBY_TYPED_FREE_IMMEDIATELY,
103
+ };
104
+
62
105
  static VALUE
63
106
  pg_simple_encoder_allocate( VALUE klass )
64
107
  {
65
108
  t_pg_coder *this;
66
- VALUE self = Data_Make_Struct( klass, t_pg_coder, NULL, -1, this );
109
+ VALUE self = TypedData_Make_Struct( klass, t_pg_coder, &pg_coder_type, this );
67
110
  pg_coder_init_encoder( self );
68
111
  return self;
69
112
  }
70
113
 
114
+ static const rb_data_type_t pg_composite_coder_type = {
115
+ "PG::CompositeCoder",
116
+ {
117
+ (RUBY_DATA_FUNC) NULL,
118
+ RUBY_TYPED_DEFAULT_FREE,
119
+ pg_composite_coder_memsize,
120
+ pg_compact_callback(pg_composite_coder_compact),
121
+ },
122
+ &pg_coder_type,
123
+ 0,
124
+ RUBY_TYPED_FREE_IMMEDIATELY,
125
+ };
126
+
71
127
  static VALUE
72
128
  pg_composite_encoder_allocate( VALUE klass )
73
129
  {
74
130
  t_pg_composite_coder *this;
75
- VALUE self = Data_Make_Struct( klass, t_pg_composite_coder, NULL, -1, this );
131
+ VALUE self = TypedData_Make_Struct( klass, t_pg_composite_coder, &pg_composite_coder_type, this );
76
132
  pg_coder_init_encoder( self );
77
133
  this->elem = NULL;
78
134
  this->needs_quotation = 1;
@@ -85,7 +141,7 @@ static VALUE
85
141
  pg_simple_decoder_allocate( VALUE klass )
86
142
  {
87
143
  t_pg_coder *this;
88
- VALUE self = Data_Make_Struct( klass, t_pg_coder, NULL, -1, this );
144
+ VALUE self = TypedData_Make_Struct( klass, t_pg_coder, &pg_coder_type, this );
89
145
  pg_coder_init_decoder( self );
90
146
  return self;
91
147
  }
@@ -94,7 +150,7 @@ static VALUE
94
150
  pg_composite_decoder_allocate( VALUE klass )
95
151
  {
96
152
  t_pg_composite_coder *this;
97
- VALUE self = Data_Make_Struct( klass, t_pg_composite_coder, NULL, -1, this );
153
+ VALUE self = TypedData_Make_Struct( klass, t_pg_composite_coder, &pg_composite_coder_type, this );
98
154
  pg_coder_init_decoder( self );
99
155
  this->elem = NULL;
100
156
  this->needs_quotation = 1;
@@ -121,7 +177,7 @@ pg_coder_encode(int argc, VALUE *argv, VALUE self)
121
177
  VALUE value;
122
178
  int len, len2;
123
179
  int enc_idx;
124
- t_pg_coder *this = DATA_PTR(self);
180
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
125
181
 
126
182
  if(argc < 1 || argc > 2){
127
183
  rb_raise(rb_eArgError, "wrong number of arguments (%i for 1..2)", argc);
@@ -143,7 +199,6 @@ pg_coder_encode(int argc, VALUE *argv, VALUE self)
143
199
 
144
200
  if( len == -1 ){
145
201
  /* The intermediate value is a String that can be used directly. */
146
- OBJ_INFECT(intermediate, value);
147
202
  return intermediate;
148
203
  }
149
204
 
@@ -155,7 +210,6 @@ pg_coder_encode(int argc, VALUE *argv, VALUE self)
155
210
  rb_obj_classname( self ), len, len2 );
156
211
  }
157
212
  rb_str_set_len( res, len2 );
158
- OBJ_INFECT(res, value);
159
213
 
160
214
  RB_GC_GUARD(intermediate);
161
215
 
@@ -180,7 +234,7 @@ pg_coder_decode(int argc, VALUE *argv, VALUE self)
180
234
  int tuple = -1;
181
235
  int field = -1;
182
236
  VALUE res;
183
- t_pg_coder *this = DATA_PTR(self);
237
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
184
238
 
185
239
  if(argc < 1 || argc > 3){
186
240
  rb_raise(rb_eArgError, "wrong number of arguments (%i for 1..3)", argc);
@@ -192,13 +246,16 @@ pg_coder_decode(int argc, VALUE *argv, VALUE self)
192
246
  if( NIL_P(argv[0]) )
193
247
  return Qnil;
194
248
 
195
- val = StringValuePtr(argv[0]);
249
+ if( this->format == 0 ){
250
+ val = StringValueCStr(argv[0]);
251
+ }else{
252
+ val = StringValuePtr(argv[0]);
253
+ }
196
254
  if( !this->dec_func ){
197
255
  rb_raise(rb_eRuntimeError, "no decoder function defined");
198
256
  }
199
257
 
200
- res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
201
- OBJ_INFECT(res, argv[0]);
258
+ res = this->dec_func(this, val, RSTRING_LENINT(argv[0]), tuple, field, ENCODING_GET(argv[0]));
202
259
 
203
260
  return res;
204
261
  }
@@ -215,7 +272,7 @@ pg_coder_decode(int argc, VALUE *argv, VALUE self)
215
272
  static VALUE
216
273
  pg_coder_oid_set(VALUE self, VALUE oid)
217
274
  {
218
- t_pg_coder *this = DATA_PTR(self);
275
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
219
276
  this->oid = NUM2UINT(oid);
220
277
  return oid;
221
278
  }
@@ -230,7 +287,7 @@ pg_coder_oid_set(VALUE self, VALUE oid)
230
287
  static VALUE
231
288
  pg_coder_oid_get(VALUE self)
232
289
  {
233
- t_pg_coder *this = DATA_PTR(self);
290
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
234
291
  return UINT2NUM(this->oid);
235
292
  }
236
293
 
@@ -246,7 +303,7 @@ pg_coder_oid_get(VALUE self)
246
303
  static VALUE
247
304
  pg_coder_format_set(VALUE self, VALUE format)
248
305
  {
249
- t_pg_coder *this = DATA_PTR(self);
306
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
250
307
  this->format = NUM2INT(format);
251
308
  return format;
252
309
  }
@@ -261,10 +318,40 @@ pg_coder_format_set(VALUE self, VALUE format)
261
318
  static VALUE
262
319
  pg_coder_format_get(VALUE self)
263
320
  {
264
- t_pg_coder *this = DATA_PTR(self);
321
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
265
322
  return INT2NUM(this->format);
266
323
  }
267
324
 
325
+ /*
326
+ * call-seq:
327
+ * coder.flags = Integer
328
+ *
329
+ * Set coder specific bitwise OR-ed flags.
330
+ * See the particular en- or decoder description for available flags.
331
+ *
332
+ * The default is +0+.
333
+ */
334
+ static VALUE
335
+ pg_coder_flags_set(VALUE self, VALUE flags)
336
+ {
337
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
338
+ this->flags = NUM2INT(flags);
339
+ return flags;
340
+ }
341
+
342
+ /*
343
+ * call-seq:
344
+ * coder.flags -> Integer
345
+ *
346
+ * Get current bitwise OR-ed coder flags.
347
+ */
348
+ static VALUE
349
+ pg_coder_flags_get(VALUE self)
350
+ {
351
+ t_pg_coder *this = RTYPEDDATA_DATA(self);
352
+ return INT2NUM(this->flags);
353
+ }
354
+
268
355
  /*
269
356
  * call-seq:
270
357
  * coder.needs_quotation = Boolean
@@ -278,7 +365,7 @@ pg_coder_format_get(VALUE self)
278
365
  static VALUE
279
366
  pg_coder_needs_quotation_set(VALUE self, VALUE needs_quotation)
280
367
  {
281
- t_pg_composite_coder *this = DATA_PTR(self);
368
+ t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
282
369
  this->needs_quotation = RTEST(needs_quotation);
283
370
  return needs_quotation;
284
371
  }
@@ -293,7 +380,7 @@ pg_coder_needs_quotation_set(VALUE self, VALUE needs_quotation)
293
380
  static VALUE
294
381
  pg_coder_needs_quotation_get(VALUE self)
295
382
  {
296
- t_pg_composite_coder *this = DATA_PTR(self);
383
+ t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
297
384
  return this->needs_quotation ? Qtrue : Qfalse;
298
385
  }
299
386
 
@@ -308,7 +395,7 @@ pg_coder_needs_quotation_get(VALUE self)
308
395
  static VALUE
309
396
  pg_coder_delimiter_set(VALUE self, VALUE delimiter)
310
397
  {
311
- t_pg_composite_coder *this = DATA_PTR(self);
398
+ t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
312
399
  StringValue(delimiter);
313
400
  if(RSTRING_LEN(delimiter) != 1)
314
401
  rb_raise( rb_eArgError, "delimiter size must be one byte");
@@ -325,7 +412,7 @@ pg_coder_delimiter_set(VALUE self, VALUE delimiter)
325
412
  static VALUE
326
413
  pg_coder_delimiter_get(VALUE self)
327
414
  {
328
- t_pg_composite_coder *this = DATA_PTR(self);
415
+ t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
329
416
  return rb_str_new(&this->delimiter, 1);
330
417
  }
331
418
 
@@ -341,12 +428,12 @@ pg_coder_delimiter_get(VALUE self)
341
428
  static VALUE
342
429
  pg_coder_elements_type_set(VALUE self, VALUE elem_type)
343
430
  {
344
- t_pg_composite_coder *this = DATA_PTR( self );
431
+ t_pg_composite_coder *this = RTYPEDDATA_DATA( self );
345
432
 
346
433
  if ( NIL_P(elem_type) ){
347
434
  this->elem = NULL;
348
435
  } else if ( rb_obj_is_kind_of(elem_type, rb_cPG_Coder) ){
349
- this->elem = DATA_PTR( elem_type );
436
+ this->elem = RTYPEDDATA_DATA( elem_type );
350
437
  } else {
351
438
  rb_raise( rb_eTypeError, "wrong elements type %s (expected some kind of PG::Coder)",
352
439
  rb_obj_classname( elem_type ) );
@@ -356,14 +443,31 @@ pg_coder_elements_type_set(VALUE self, VALUE elem_type)
356
443
  return elem_type;
357
444
  }
358
445
 
446
+ static const rb_data_type_t pg_coder_cfunc_type = {
447
+ "PG::Coder::CFUNC",
448
+ {
449
+ (RUBY_DATA_FUNC)NULL,
450
+ (RUBY_DATA_FUNC)NULL,
451
+ (size_t (*)(const void *))NULL,
452
+ },
453
+ 0,
454
+ 0,
455
+ RUBY_TYPED_FREE_IMMEDIATELY,
456
+ };
457
+
359
458
  void
360
459
  pg_define_coder( const char *name, void *func, VALUE base_klass, VALUE nsp )
361
460
  {
362
- VALUE cfunc_obj = Data_Wrap_Struct( rb_cObject, NULL, NULL, func );
461
+ VALUE cfunc_obj = TypedData_Wrap_Struct( rb_cObject, &pg_coder_cfunc_type, func );
363
462
  VALUE coder_klass = rb_define_class_under( nsp, name, base_klass );
364
463
  if( nsp==rb_mPG_BinaryEncoder || nsp==rb_mPG_BinaryDecoder )
365
464
  rb_include_module( coder_klass, rb_mPG_BinaryFormatting );
366
465
 
466
+ if( nsp==rb_mPG_BinaryEncoder || nsp==rb_mPG_TextEncoder )
467
+ rb_define_method( coder_klass, "encode", pg_coder_encode, -1 );
468
+ if( nsp==rb_mPG_BinaryDecoder || nsp==rb_mPG_TextDecoder )
469
+ rb_define_method( coder_klass, "decode", pg_coder_decode, -1 );
470
+
367
471
  rb_define_const( coder_klass, "CFUNC", cfunc_obj );
368
472
 
369
473
  RB_GC_GUARD(cfunc_obj);
@@ -403,14 +507,14 @@ pg_coder_enc_func(t_pg_coder *this)
403
507
  }
404
508
 
405
509
  static VALUE
406
- pg_text_dec_in_ruby(t_pg_coder *this, char *val, int len, int tuple, int field, int enc_idx)
510
+ pg_text_dec_in_ruby(t_pg_coder *this, const char *val, int len, int tuple, int field, int enc_idx)
407
511
  {
408
512
  VALUE string = pg_text_dec_string(this, val, len, tuple, field, enc_idx);
409
513
  return rb_funcall( this->coder_obj, s_id_decode, 3, string, INT2NUM(tuple), INT2NUM(field) );
410
514
  }
411
515
 
412
516
  static VALUE
413
- pg_bin_dec_in_ruby(t_pg_coder *this, char *val, int len, int tuple, int field, int enc_idx)
517
+ pg_bin_dec_in_ruby(t_pg_coder *this, const char *val, int len, int tuple, int field, int enc_idx)
414
518
  {
415
519
  VALUE string = pg_bin_dec_bytea(this, val, len, tuple, field, enc_idx);
416
520
  return rb_funcall( this->coder_obj, s_id_decode, 3, string, INT2NUM(tuple), INT2NUM(field) );
@@ -457,14 +561,25 @@ init_pg_coder()
457
561
  rb_define_method( rb_cPG_Coder, "oid", pg_coder_oid_get, 0 );
458
562
  rb_define_method( rb_cPG_Coder, "format=", pg_coder_format_set, 1 );
459
563
  rb_define_method( rb_cPG_Coder, "format", pg_coder_format_get, 0 );
564
+ rb_define_method( rb_cPG_Coder, "flags=", pg_coder_flags_set, 1 );
565
+ rb_define_method( rb_cPG_Coder, "flags", pg_coder_flags_get, 0 );
566
+
567
+ /* define flags to be used with PG::Coder#flags= */
568
+ rb_define_const( rb_cPG_Coder, "TIMESTAMP_DB_UTC", INT2NUM(PG_CODER_TIMESTAMP_DB_UTC));
569
+ rb_define_const( rb_cPG_Coder, "TIMESTAMP_DB_LOCAL", INT2NUM(PG_CODER_TIMESTAMP_DB_LOCAL));
570
+ rb_define_const( rb_cPG_Coder, "TIMESTAMP_APP_UTC", INT2NUM(PG_CODER_TIMESTAMP_APP_UTC));
571
+ rb_define_const( rb_cPG_Coder, "TIMESTAMP_APP_LOCAL", INT2NUM(PG_CODER_TIMESTAMP_APP_LOCAL));
572
+ rb_define_const( rb_cPG_Coder, "FORMAT_ERROR_MASK", INT2NUM(PG_CODER_FORMAT_ERROR_MASK));
573
+ rb_define_const( rb_cPG_Coder, "FORMAT_ERROR_TO_RAISE", INT2NUM(PG_CODER_FORMAT_ERROR_TO_RAISE));
574
+ rb_define_const( rb_cPG_Coder, "FORMAT_ERROR_TO_STRING", INT2NUM(PG_CODER_FORMAT_ERROR_TO_STRING));
575
+ rb_define_const( rb_cPG_Coder, "FORMAT_ERROR_TO_PARTIAL", INT2NUM(PG_CODER_FORMAT_ERROR_TO_PARTIAL));
576
+
460
577
  /*
461
578
  * Name of the coder or the corresponding data type.
462
579
  *
463
580
  * This accessor is only used in PG::Coder#inspect .
464
581
  */
465
582
  rb_define_attr( rb_cPG_Coder, "name", 1, 1 );
466
- rb_define_method( rb_cPG_Coder, "encode", pg_coder_encode, -1 );
467
- rb_define_method( rb_cPG_Coder, "decode", pg_coder_decode, -1 );
468
583
 
469
584
  /* Document-class: PG::SimpleCoder < PG::Coder */
470
585
  rb_cPG_SimpleCoder = rb_define_class_under( rb_mPG, "SimpleCoder", rb_cPG_Coder );