pg 1.3.4 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.appveyor.yml +15 -9
- data/.github/workflows/binary-gems.yml +43 -12
- data/.github/workflows/source-gem.yml +28 -20
- data/.gitignore +11 -2
- data/.travis.yml +2 -2
- data/{History.rdoc → History.md} +293 -122
- data/README.ja.md +276 -0
- data/README.md +286 -0
- data/Rakefile +15 -6
- data/Rakefile.cross +7 -11
- data/certs/larskanis-2023.pem +24 -0
- data/ext/errorcodes.def +4 -0
- data/ext/errorcodes.txt +2 -1
- data/ext/pg.c +14 -54
- data/ext/pg.h +11 -5
- data/ext/pg_binary_decoder.c +80 -1
- data/ext/pg_binary_encoder.c +225 -1
- data/ext/pg_coder.c +17 -8
- data/ext/pg_connection.c +380 -250
- data/ext/pg_copy_coder.c +307 -18
- data/ext/pg_errors.c +1 -1
- data/ext/pg_record_coder.c +12 -9
- data/ext/pg_result.c +104 -27
- data/ext/pg_text_decoder.c +28 -10
- data/ext/pg_text_encoder.c +23 -10
- data/ext/pg_tuple.c +35 -32
- data/ext/pg_type_map.c +4 -3
- data/ext/pg_type_map_all_strings.c +3 -3
- data/ext/pg_type_map_by_class.c +6 -4
- data/ext/pg_type_map_by_column.c +9 -5
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +8 -5
- data/ext/pg_type_map_in_ruby.c +6 -3
- data/lib/pg/basic_type_map_based_on_result.rb +21 -1
- data/lib/pg/basic_type_map_for_queries.rb +13 -8
- data/lib/pg/basic_type_map_for_results.rb +26 -3
- data/lib/pg/basic_type_registry.rb +36 -33
- data/lib/pg/binary_decoder/date.rb +9 -0
- data/lib/pg/binary_decoder/timestamp.rb +26 -0
- data/lib/pg/binary_encoder/timestamp.rb +20 -0
- data/lib/pg/coder.rb +15 -13
- data/lib/pg/connection.rb +265 -136
- data/lib/pg/exceptions.rb +14 -1
- data/lib/pg/text_decoder/date.rb +18 -0
- data/lib/pg/text_decoder/inet.rb +9 -0
- data/lib/pg/text_decoder/json.rb +14 -0
- data/lib/pg/text_decoder/numeric.rb +9 -0
- data/lib/pg/text_decoder/timestamp.rb +30 -0
- data/lib/pg/text_encoder/date.rb +12 -0
- data/lib/pg/text_encoder/inet.rb +28 -0
- data/lib/pg/text_encoder/json.rb +14 -0
- data/lib/pg/text_encoder/numeric.rb +9 -0
- data/lib/pg/text_encoder/timestamp.rb +24 -0
- data/lib/pg/version.rb +1 -1
- data/lib/pg.rb +59 -19
- data/pg.gemspec +4 -2
- data/rakelib/task_extension.rb +1 -1
- data/translation/.po4a-version +7 -0
- data/translation/po/all.pot +910 -0
- data/translation/po/ja.po +1047 -0
- data/translation/po4a.cfg +12 -0
- data.tar.gz.sig +0 -0
- metadata +101 -32
- metadata.gz.sig +0 -0
- data/README.ja.rdoc +0 -13
- data/README.rdoc +0 -214
- data/lib/pg/binary_decoder.rb +0 -23
- data/lib/pg/constants.rb +0 -12
- data/lib/pg/text_decoder.rb +0 -46
- data/lib/pg/text_encoder.rb +0 -59
data/ext/pg_coder.c
CHANGED
@@ -35,7 +35,7 @@ pg_coder_init_encoder( VALUE self )
|
|
35
35
|
this->enc_func = NULL;
|
36
36
|
}
|
37
37
|
this->dec_func = NULL;
|
38
|
-
this->coder_obj
|
38
|
+
RB_OBJ_WRITE(self, &this->coder_obj, self);
|
39
39
|
this->oid = 0;
|
40
40
|
this->format = 0;
|
41
41
|
this->flags = 0;
|
@@ -54,7 +54,7 @@ pg_coder_init_decoder( VALUE self )
|
|
54
54
|
} else {
|
55
55
|
this->dec_func = NULL;
|
56
56
|
}
|
57
|
-
this->coder_obj
|
57
|
+
RB_OBJ_WRITE(self, &this->coder_obj, self);
|
58
58
|
this->oid = 0;
|
59
59
|
this->format = 0;
|
60
60
|
this->flags = 0;
|
@@ -99,7 +99,9 @@ const rb_data_type_t pg_coder_type = {
|
|
99
99
|
},
|
100
100
|
0,
|
101
101
|
0,
|
102
|
-
|
102
|
+
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
|
103
|
+
// macro to update VALUE references, as to trigger write barriers.
|
104
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | PG_RUBY_TYPED_FROZEN_SHAREABLE,
|
103
105
|
};
|
104
106
|
|
105
107
|
static VALUE
|
@@ -121,7 +123,7 @@ static const rb_data_type_t pg_composite_coder_type = {
|
|
121
123
|
},
|
122
124
|
&pg_coder_type,
|
123
125
|
0,
|
124
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
126
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | PG_RUBY_TYPED_FROZEN_SHAREABLE,
|
125
127
|
};
|
126
128
|
|
127
129
|
static VALUE
|
@@ -273,6 +275,7 @@ static VALUE
|
|
273
275
|
pg_coder_oid_set(VALUE self, VALUE oid)
|
274
276
|
{
|
275
277
|
t_pg_coder *this = RTYPEDDATA_DATA(self);
|
278
|
+
rb_check_frozen(self);
|
276
279
|
this->oid = NUM2UINT(oid);
|
277
280
|
return oid;
|
278
281
|
}
|
@@ -304,6 +307,7 @@ static VALUE
|
|
304
307
|
pg_coder_format_set(VALUE self, VALUE format)
|
305
308
|
{
|
306
309
|
t_pg_coder *this = RTYPEDDATA_DATA(self);
|
310
|
+
rb_check_frozen(self);
|
307
311
|
this->format = NUM2INT(format);
|
308
312
|
return format;
|
309
313
|
}
|
@@ -335,6 +339,7 @@ static VALUE
|
|
335
339
|
pg_coder_flags_set(VALUE self, VALUE flags)
|
336
340
|
{
|
337
341
|
t_pg_coder *this = RTYPEDDATA_DATA(self);
|
342
|
+
rb_check_frozen(self);
|
338
343
|
this->flags = NUM2INT(flags);
|
339
344
|
return flags;
|
340
345
|
}
|
@@ -366,6 +371,7 @@ static VALUE
|
|
366
371
|
pg_coder_needs_quotation_set(VALUE self, VALUE needs_quotation)
|
367
372
|
{
|
368
373
|
t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
|
374
|
+
rb_check_frozen(self);
|
369
375
|
this->needs_quotation = RTEST(needs_quotation);
|
370
376
|
return needs_quotation;
|
371
377
|
}
|
@@ -396,6 +402,7 @@ static VALUE
|
|
396
402
|
pg_coder_delimiter_set(VALUE self, VALUE delimiter)
|
397
403
|
{
|
398
404
|
t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
|
405
|
+
rb_check_frozen(self);
|
399
406
|
StringValue(delimiter);
|
400
407
|
if(RSTRING_LEN(delimiter) != 1)
|
401
408
|
rb_raise( rb_eArgError, "delimiter size must be one byte");
|
@@ -430,6 +437,7 @@ pg_coder_elements_type_set(VALUE self, VALUE elem_type)
|
|
430
437
|
{
|
431
438
|
t_pg_composite_coder *this = RTYPEDDATA_DATA( self );
|
432
439
|
|
440
|
+
rb_check_frozen(self);
|
433
441
|
if ( NIL_P(elem_type) ){
|
434
442
|
this->elem = NULL;
|
435
443
|
} else if ( rb_obj_is_kind_of(elem_type, rb_cPG_Coder) ){
|
@@ -452,10 +460,10 @@ static const rb_data_type_t pg_coder_cfunc_type = {
|
|
452
460
|
},
|
453
461
|
0,
|
454
462
|
0,
|
455
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
463
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | PG_RUBY_TYPED_FROZEN_SHAREABLE,
|
456
464
|
};
|
457
465
|
|
458
|
-
|
466
|
+
VALUE
|
459
467
|
pg_define_coder( const char *name, void *func, VALUE base_klass, VALUE nsp )
|
460
468
|
{
|
461
469
|
VALUE cfunc_obj = TypedData_Wrap_Struct( rb_cObject, &pg_coder_cfunc_type, func );
|
@@ -468,9 +476,10 @@ pg_define_coder( const char *name, void *func, VALUE base_klass, VALUE nsp )
|
|
468
476
|
if( nsp==rb_mPG_BinaryDecoder || nsp==rb_mPG_TextDecoder )
|
469
477
|
rb_define_method( coder_klass, "decode", pg_coder_decode, -1 );
|
470
478
|
|
471
|
-
rb_define_const( coder_klass, "CFUNC", cfunc_obj );
|
479
|
+
rb_define_const( coder_klass, "CFUNC", rb_obj_freeze(cfunc_obj) );
|
472
480
|
|
473
481
|
RB_GC_GUARD(cfunc_obj);
|
482
|
+
return coder_klass;
|
474
483
|
}
|
475
484
|
|
476
485
|
|
@@ -537,7 +546,7 @@ pg_coder_dec_func(t_pg_coder *this, int binary)
|
|
537
546
|
|
538
547
|
|
539
548
|
void
|
540
|
-
init_pg_coder()
|
549
|
+
init_pg_coder(void)
|
541
550
|
{
|
542
551
|
s_id_encode = rb_intern("encode");
|
543
552
|
s_id_decode = rb_intern("decode");
|