pg 1.5.4 → 1.6.1
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 +0 -0
- data/{History.md → CHANGELOG.md} +106 -4
- data/Gemfile +12 -3
- data/README-Windows.rdoc +1 -1
- data/README.ja.md +4 -4
- data/README.md +58 -17
- data/Rakefile +95 -14
- data/certs/kanis@comcard.de.pem +20 -0
- data/certs/larskanis-2024.pem +24 -0
- data/ext/errorcodes.def +4 -5
- data/ext/errorcodes.txt +2 -5
- data/ext/extconf.rb +161 -14
- data/ext/gvl_wrappers.c +13 -2
- data/ext/gvl_wrappers.h +33 -0
- data/ext/pg.c +17 -6
- data/ext/pg.h +9 -9
- data/ext/pg_binary_decoder.c +152 -0
- data/ext/pg_binary_encoder.c +211 -8
- data/ext/pg_cancel_connection.c +360 -0
- data/ext/pg_coder.c +54 -5
- data/ext/pg_connection.c +409 -167
- data/ext/pg_copy_coder.c +19 -15
- data/ext/pg_record_coder.c +7 -7
- data/ext/pg_result.c +11 -13
- data/ext/pg_text_decoder.c +4 -1
- data/ext/pg_text_encoder.c +37 -18
- data/ext/pg_tuple.c +2 -2
- data/ext/pg_type_map.c +1 -1
- data/ext/pg_type_map_all_strings.c +1 -1
- data/ext/pg_type_map_by_class.c +1 -1
- data/ext/pg_type_map_by_column.c +2 -1
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +3 -1
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/lib/pg/basic_type_map_for_queries.rb +15 -7
- data/lib/pg/basic_type_registry.rb +16 -4
- data/lib/pg/cancel_connection.rb +53 -0
- data/lib/pg/coder.rb +4 -2
- data/lib/pg/connection.rb +310 -167
- data/lib/pg/exceptions.rb +6 -0
- data/lib/pg/text_decoder/date.rb +3 -0
- data/lib/pg/text_decoder/json.rb +3 -0
- data/lib/pg/text_encoder/date.rb +1 -0
- data/lib/pg/text_encoder/inet.rb +3 -0
- data/lib/pg/text_encoder/json.rb +3 -0
- data/lib/pg/version.rb +1 -1
- data/lib/pg.rb +23 -8
- data/misc/yugabyte/Dockerfile +9 -0
- data/misc/yugabyte/docker-compose.yml +28 -0
- data/misc/yugabyte/pg-test.rb +45 -0
- data/pg.gemspec +8 -4
- data/ports/patches/krb5/1.21.3/0001-Allow-static-linking-krb5-library.patch +30 -0
- data/ports/patches/openssl/3.5.1/0001-aarch64-mingw.patch +21 -0
- data/ports/patches/postgresql/17.5/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch +42 -0
- data/ports/patches/postgresql/17.5/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch +52 -0
- data/rakelib/pg_gem_helper.rb +64 -0
- data.tar.gz.sig +0 -0
- metadata +45 -47
- metadata.gz.sig +0 -0
- data/.appveyor.yml +0 -42
- data/.gems +0 -6
- data/.gemtest +0 -0
- data/.github/workflows/binary-gems.yml +0 -117
- data/.github/workflows/source-gem.yml +0 -141
- data/.gitignore +0 -22
- data/.hgsigs +0 -34
- data/.hgtags +0 -41
- data/.irbrc +0 -23
- data/.pryrc +0 -23
- data/.tm_properties +0 -21
- data/.travis.yml +0 -49
- data/Manifest.txt +0 -72
- data/Rakefile.cross +0 -298
- data/translation/.po4a-version +0 -7
- data/translation/po/all.pot +0 -936
- data/translation/po/ja.po +0 -1036
- data/translation/po4a.cfg +0 -12
data/ext/pg_coder.c
CHANGED
@@ -95,7 +95,7 @@ const rb_data_type_t pg_coder_type = {
|
|
95
95
|
(RUBY_DATA_FUNC) NULL,
|
96
96
|
RUBY_TYPED_DEFAULT_FREE,
|
97
97
|
pg_coder_memsize,
|
98
|
-
|
98
|
+
pg_coder_compact,
|
99
99
|
},
|
100
100
|
0,
|
101
101
|
0,
|
@@ -119,7 +119,7 @@ static const rb_data_type_t pg_composite_coder_type = {
|
|
119
119
|
(RUBY_DATA_FUNC) NULL,
|
120
120
|
RUBY_TYPED_DEFAULT_FREE,
|
121
121
|
pg_composite_coder_memsize,
|
122
|
-
|
122
|
+
pg_composite_coder_compact,
|
123
123
|
},
|
124
124
|
&pg_coder_type,
|
125
125
|
0,
|
@@ -135,6 +135,7 @@ pg_composite_encoder_allocate( VALUE klass )
|
|
135
135
|
this->elem = NULL;
|
136
136
|
this->needs_quotation = 1;
|
137
137
|
this->delimiter = ',';
|
138
|
+
this->dimensions = -1;
|
138
139
|
rb_iv_set( self, "@elements_type", Qnil );
|
139
140
|
return self;
|
140
141
|
}
|
@@ -157,6 +158,7 @@ pg_composite_decoder_allocate( VALUE klass )
|
|
157
158
|
this->elem = NULL;
|
158
159
|
this->needs_quotation = 1;
|
159
160
|
this->delimiter = ',';
|
161
|
+
this->dimensions = -1;
|
160
162
|
rb_iv_set( self, "@elements_type", Qnil );
|
161
163
|
return self;
|
162
164
|
}
|
@@ -175,7 +177,7 @@ static VALUE
|
|
175
177
|
pg_coder_encode(int argc, VALUE *argv, VALUE self)
|
176
178
|
{
|
177
179
|
VALUE res;
|
178
|
-
VALUE intermediate;
|
180
|
+
VALUE intermediate = Qnil;
|
179
181
|
VALUE value;
|
180
182
|
int len, len2;
|
181
183
|
int enc_idx;
|
@@ -213,8 +215,6 @@ pg_coder_encode(int argc, VALUE *argv, VALUE self)
|
|
213
215
|
}
|
214
216
|
rb_str_set_len( res, len2 );
|
215
217
|
|
216
|
-
RB_GC_GUARD(intermediate);
|
217
|
-
|
218
218
|
return res;
|
219
219
|
}
|
220
220
|
|
@@ -364,6 +364,7 @@ pg_coder_flags_get(VALUE self)
|
|
364
364
|
* Specifies whether the assigned #elements_type requires quotation marks to
|
365
365
|
* be transferred safely. Encoding with #needs_quotation=false is somewhat
|
366
366
|
* faster.
|
367
|
+
* It is only used by text coders and ignored by binary coders.
|
367
368
|
*
|
368
369
|
* The default is +true+. This option is ignored for decoding of values.
|
369
370
|
*/
|
@@ -397,6 +398,7 @@ pg_coder_needs_quotation_get(VALUE self)
|
|
397
398
|
* Specifies the character that separates values within the composite type.
|
398
399
|
* The default is a comma.
|
399
400
|
* This must be a single one-byte character.
|
401
|
+
* It is only used by text coders and ignored by binary coders.
|
400
402
|
*/
|
401
403
|
static VALUE
|
402
404
|
pg_coder_delimiter_set(VALUE self, VALUE delimiter)
|
@@ -423,6 +425,49 @@ pg_coder_delimiter_get(VALUE self)
|
|
423
425
|
return rb_str_new(&this->delimiter, 1);
|
424
426
|
}
|
425
427
|
|
428
|
+
/*
|
429
|
+
* call-seq:
|
430
|
+
* coder.dimensions = Integer
|
431
|
+
* coder.dimensions = nil
|
432
|
+
*
|
433
|
+
* Set number of array dimensions to be encoded.
|
434
|
+
*
|
435
|
+
* This property ensures, that this number of dimensions is always encoded.
|
436
|
+
* If less dimensions than this number are in the given value, an ArgumentError is raised.
|
437
|
+
* If more dimensions than this number are in the value, the Array value is passed to the next encoder.
|
438
|
+
*
|
439
|
+
* Setting dimensions is especially useful, when a Record shall be encoded into an Array, since the Array encoder can not distinguish if the array shall be encoded as a higher dimension or as a record otherwise.
|
440
|
+
*
|
441
|
+
* The default is +nil+.
|
442
|
+
*
|
443
|
+
* See #dimensions
|
444
|
+
*/
|
445
|
+
static VALUE
|
446
|
+
pg_coder_dimensions_set(VALUE self, VALUE dimensions)
|
447
|
+
{
|
448
|
+
t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
|
449
|
+
rb_check_frozen(self);
|
450
|
+
if(!NIL_P(dimensions) && NUM2INT(dimensions) < 0)
|
451
|
+
rb_raise( rb_eArgError, "dimensions must be nil or >= 0");
|
452
|
+
this->dimensions = NIL_P(dimensions) ? -1 : NUM2INT(dimensions);
|
453
|
+
return dimensions;
|
454
|
+
}
|
455
|
+
|
456
|
+
/*
|
457
|
+
* call-seq:
|
458
|
+
* coder.dimensions -> Integer | nil
|
459
|
+
*
|
460
|
+
* Get number of enforced array dimensions or +nil+ if not set.
|
461
|
+
*
|
462
|
+
* See #dimensions=
|
463
|
+
*/
|
464
|
+
static VALUE
|
465
|
+
pg_coder_dimensions_get(VALUE self)
|
466
|
+
{
|
467
|
+
t_pg_composite_coder *this = RTYPEDDATA_DATA(self);
|
468
|
+
return this->dimensions < 0 ? Qnil : INT2NUM(this->dimensions);
|
469
|
+
}
|
470
|
+
|
426
471
|
/*
|
427
472
|
* call-seq:
|
428
473
|
* coder.elements_type = coder
|
@@ -604,6 +649,8 @@ init_pg_coder(void)
|
|
604
649
|
*
|
605
650
|
* This is the base class for all type cast classes of PostgreSQL types,
|
606
651
|
* that are made up of some sub type.
|
652
|
+
*
|
653
|
+
* See PG::TextEncoder::Array, PG::TextDecoder::Array, PG::BinaryEncoder::Array, PG::BinaryDecoder::Array, etc.
|
607
654
|
*/
|
608
655
|
rb_cPG_CompositeCoder = rb_define_class_under( rb_mPG, "CompositeCoder", rb_cPG_Coder );
|
609
656
|
rb_define_method( rb_cPG_CompositeCoder, "elements_type=", pg_coder_elements_type_set, 1 );
|
@@ -612,6 +659,8 @@ init_pg_coder(void)
|
|
612
659
|
rb_define_method( rb_cPG_CompositeCoder, "needs_quotation?", pg_coder_needs_quotation_get, 0 );
|
613
660
|
rb_define_method( rb_cPG_CompositeCoder, "delimiter=", pg_coder_delimiter_set, 1 );
|
614
661
|
rb_define_method( rb_cPG_CompositeCoder, "delimiter", pg_coder_delimiter_get, 0 );
|
662
|
+
rb_define_method( rb_cPG_CompositeCoder, "dimensions=", pg_coder_dimensions_set, 1 );
|
663
|
+
rb_define_method( rb_cPG_CompositeCoder, "dimensions", pg_coder_dimensions_get, 0 );
|
615
664
|
|
616
665
|
/* Document-class: PG::CompositeEncoder < PG::CompositeCoder */
|
617
666
|
rb_cPG_CompositeEncoder = rb_define_class_under( rb_mPG, "CompositeEncoder", rb_cPG_CompositeCoder );
|