pg 1.5.6-x64-mingw-ucrt → 1.5.7-x64-mingw-ucrt
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 +1 -1
- data/.github/workflows/source-gem.yml +3 -0
- data/Gemfile +3 -0
- data/History.md +16 -4
- data/Rakefile.cross +3 -3
- data/ext/extconf.rb +3 -0
- data/ext/pg.c +1 -1
- data/ext/pg_connection.c +19 -12
- data/ext/pg_copy_coder.c +6 -6
- data/ext/pg_record_coder.c +5 -5
- data/ext/pg_result.c +2 -2
- data/ext/pg_text_decoder.c +1 -1
- data/ext/pg_text_encoder.c +11 -11
- data/lib/3.1/pg_ext.so +0 -0
- data/lib/3.2/pg_ext.so +0 -0
- data/lib/3.3/pg_ext.so +0 -0
- data/lib/pg/basic_type_map_for_queries.rb +1 -1
- data/lib/pg/basic_type_registry.rb +9 -2
- data/lib/pg/connection.rb +10 -2
- data/lib/pg/exceptions.rb +6 -0
- data/lib/pg/version.rb +1 -1
- data/lib/pg.rb +10 -0
- data/lib/x64-mingw-ucrt/libpq.dll +0 -0
- data.tar.gz.sig +0 -0
- metadata +4 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e7ec0395615a0debac4f139fdeb76aadca9ad918f72c89df8631114680ccb9f
|
4
|
+
data.tar.gz: ca2579ddcb81da81d8f8fb0d559794d698b9b9df078ec6737751a1a240073c29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2334c4700390384a8ec7654a204d5df32278a65bf89be66e2a43bce6b629406b42a92d14b99e56f501619589e336dc9e02ac386eb0fac25ded33752148513ae
|
7
|
+
data.tar.gz: 19e2f21a74c06a6bc3f0211c109dfe66317ac6b4917b241e2974355066d00386043747a9a4edc6a51789c8117c84c63fad6c041eab26ae5b619d892697e8dcb3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.appveyor.yml
CHANGED
@@ -120,6 +120,7 @@ jobs:
|
|
120
120
|
wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \
|
121
121
|
sudo mkdir -p /Library/PostgreSQL && \
|
122
122
|
sudo unzip postgresql-$PGVERSION-binaries.zip -d /Library/PostgreSQL/$PGVER && \
|
123
|
+
sudo mv /Library/PostgreSQL/$PGVER/pgsql/* /Library/PostgreSQL/$PGVER/ && \
|
123
124
|
echo /Library/PostgreSQL/$PGVER/bin >> $GITHUB_PATH
|
124
125
|
|
125
126
|
- run: gem update --system 3.3.26
|
@@ -130,6 +131,8 @@ jobs:
|
|
130
131
|
- name: Run specs
|
131
132
|
env:
|
132
133
|
PG_DEBUG: 0
|
134
|
+
# Temprary fix only for Truffleruby-24.0.0:
|
135
|
+
TRUFFLERUBYOPT: --experimental-options --keep-handles-alive
|
133
136
|
run: ruby -rpg -S rspec spec/**/*_spec.rb -cfdoc
|
134
137
|
|
135
138
|
- name: Print logs if job failed
|
data/Gemfile
CHANGED
@@ -11,7 +11,10 @@ group :development, :test do
|
|
11
11
|
gem "rake-compiler-dock", "~> 1.0"
|
12
12
|
gem "rdoc", "~> 6.4"
|
13
13
|
gem "rspec", "~> 3.5"
|
14
|
+
gem "ostruct", "~> 0.5" # for Rakefile.cross
|
14
15
|
# "bigdecimal" is a gem on ruby-3.4+ and it's optional for ruby-pg.
|
15
16
|
# Specs should succeed without it, but 4 examples are then excluded.
|
17
|
+
# With bigdecimal commented out here, corresponding tests are omitted on ruby-3.4+ but are executed on ruby < 3.4.
|
18
|
+
# That way we can check both situations in CI.
|
16
19
|
# gem "bigdecimal", "~> 3.0"
|
17
20
|
end
|
data/History.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## v1.5.7 [2024-07-28] Lars Kanis <lars@greiz-reinsdorf.de>
|
2
|
+
|
3
|
+
- Remove deprecated use of fptr->fd.[#562](https://github.com/ged/ruby-pg/pull/562)
|
4
|
+
Direct access is disallowed since ruby-3.4.
|
5
|
+
- Make `pgconn_connect_poll` close the socket prior to calling `PQconnectPoll`. [#564](https://github.com/ged/ruby-pg/pull/564)
|
6
|
+
This could result in an exception while connecting when used multi threaded.
|
7
|
+
- Fix several typos and improve spelling in documentation and code. [#566](https://github.com/ged/ruby-pg/pull/566)
|
8
|
+
- Add missing PG::RollbackTransaction as an option to exit conn.transaction. [#560](https://github.com/ged/ruby-pg/pull/560)
|
9
|
+
Usage like in rails: https://api.rubyonrails.org/classes/ActiveRecord/Rollback.html
|
10
|
+
- Don't print a warning when bigdecimal is required on ruby-3.4+ [#574](https://github.com/ged/ruby-pg/pull/574)
|
11
|
+
|
12
|
+
|
1
13
|
## v1.5.6 [2024-03-01] Lars Kanis <lars@greiz-reinsdorf.de>
|
2
14
|
|
3
15
|
- Renew address resolution (DNS) in conn.reset. [#558](https://github.com/ged/ruby-pg/pull/558)
|
@@ -92,7 +104,7 @@ Removed:
|
|
92
104
|
Repository:
|
93
105
|
|
94
106
|
- `rake test` tries to find PostgreSQL server commands by pg_config [#503](https://github.com/ged/ruby-pg/pull/503)
|
95
|
-
So there's no need to set the PATH
|
107
|
+
So there's no need to set the PATH manually any longer.
|
96
108
|
|
97
109
|
|
98
110
|
## v1.4.6 [2023-02-26] Lars Kanis <lars@greiz-reinsdorf.de>
|
@@ -161,7 +173,7 @@ Added:
|
|
161
173
|
Bugfixes:
|
162
174
|
|
163
175
|
- Try IPv6 and IPv4 addresses, if DNS resolves to both. [#452](https://github.com/ged/ruby-pg/pull/452)
|
164
|
-
- Re-add block-call semantics to PG::Connection.new
|
176
|
+
- Re-add block-call semantics to PG::Connection.new accidentally removed in pg-1.3.0. [#454](https://github.com/ged/ruby-pg/pull/454)
|
165
177
|
- Handle client error after all data consumed in #copy_data for output. [#455](https://github.com/ged/ruby-pg/pull/455)
|
166
178
|
- Avoid spurious keyword argument warning on Ruby 2.7. [#456](https://github.com/ged/ruby-pg/pull/456)
|
167
179
|
- Change connection setup to respect connect_timeout parameter. [#459](https://github.com/ged/ruby-pg/pull/459)
|
@@ -200,7 +212,7 @@ Bugfixes:
|
|
200
212
|
|
201
213
|
- Don't leak IO in case of connection errors. [#439](https://github.com/ged/ruby-pg/pull/439)
|
202
214
|
Previously it was kept open until the PG::Connection was garbage collected.
|
203
|
-
- Fix a performance
|
215
|
+
- Fix a performance regression in conn.get_result noticed in single row mode. [#442](https://github.com/ged/ruby-pg/pull/442)
|
204
216
|
- Fix occasional error Errno::EBADF (Bad file descriptor) while connecting. [#444](https://github.com/ged/ruby-pg/pull/444)
|
205
217
|
- Fix compatibility of res.stream_each* methods with Fiber.scheduler. [#446](https://github.com/ged/ruby-pg/pull/446)
|
206
218
|
- Remove FL_TEST and FL_SET, which are MRI-internal. [#437](https://github.com/ged/ruby-pg/pull/437)
|
@@ -286,7 +298,7 @@ Type cast enhancements:
|
|
286
298
|
- Add PG::BasicTypeMapForQueries::BinaryData for encoding of bytea columns. [#348](https://github.com/ged/ruby-pg/pull/348)
|
287
299
|
- Reduce time to build coder maps and permit to reuse them for several type maps per PG::BasicTypeRegistry::CoderMapsBundle.new(conn) . [#376](https://github.com/ged/ruby-pg/pull/376)
|
288
300
|
- Make BasicTypeRegistry a class and use a global default instance of it.
|
289
|
-
Now a local type registry can be
|
301
|
+
Now a local type registry can be instantiated and given to the type map, to avoid changing shared global states.
|
290
302
|
- Allow PG::BasicTypeMapForQueries to take a Proc as callback for undefined types.
|
291
303
|
|
292
304
|
Other Enhancements:
|
data/Rakefile.cross
CHANGED
@@ -31,8 +31,8 @@ class CrossLibrary < OpenStruct
|
|
31
31
|
self.host_platform = toolchain
|
32
32
|
|
33
33
|
# Cross-compilation constants
|
34
|
-
self.openssl_version = ENV['OPENSSL_VERSION'] || '3.
|
35
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '16.
|
34
|
+
self.openssl_version = ENV['OPENSSL_VERSION'] || '3.3.1'
|
35
|
+
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '16.3'
|
36
36
|
|
37
37
|
# Check if symlinks work in the current working directory.
|
38
38
|
# This fails, if rake-compiler-dock is running on a Windows box.
|
@@ -291,7 +291,7 @@ CrossLibraries.each do |xlib|
|
|
291
291
|
RakeCompilerDock.sh <<-EOT, platform: platform
|
292
292
|
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
293
293
|
bundle install --local &&
|
294
|
-
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem
|
294
|
+
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=3.3.0:3.2.0:3.1.0:3.0.0:2.7.0:2.6.0:2.5.0
|
295
295
|
EOT
|
296
296
|
end
|
297
297
|
desc "Build the windows binary gems"
|
data/ext/extconf.rb
CHANGED
@@ -9,6 +9,8 @@ if ENV['MAINTAINER_MODE']
|
|
9
9
|
' -ggdb' <<
|
10
10
|
' -DDEBUG' <<
|
11
11
|
' -pedantic'
|
12
|
+
$LDFLAGS <<
|
13
|
+
' -ggdb'
|
12
14
|
end
|
13
15
|
|
14
16
|
if pgdir = with_config( 'pg' )
|
@@ -158,6 +160,7 @@ have_func 'timegm'
|
|
158
160
|
have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
|
159
161
|
have_func 'rb_gc_mark_movable' # since ruby-2.7
|
160
162
|
have_func 'rb_io_wait' # since ruby-3.0
|
163
|
+
have_func 'rb_io_descriptor' # since ruby-3.1
|
161
164
|
|
162
165
|
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
163
166
|
have_header 'unistd.h'
|
data/ext/pg.c
CHANGED
@@ -543,7 +543,7 @@ Init_pg_ext(void)
|
|
543
543
|
/* Result#result_error_field argument constant
|
544
544
|
*
|
545
545
|
* The SQLSTATE code for the error.
|
546
|
-
* The SQLSTATE code
|
546
|
+
* The SQLSTATE code identifies the type of error that has occurred; it can be used by front-end applications to perform specific operations (such as error handling) in response to a particular database error.
|
547
547
|
* For a list of the possible SQLSTATE codes, see Appendix A.
|
548
548
|
* This field is not localizable, and is always present.
|
549
549
|
*/
|
data/ext/pg_connection.c
CHANGED
@@ -33,8 +33,8 @@ static VALUE pgconn_async_flush(VALUE self);
|
|
33
33
|
#ifdef __GNUC__
|
34
34
|
__attribute__((format(printf, 3, 4)))
|
35
35
|
#endif
|
36
|
-
static void
|
37
|
-
pg_raise_conn_error( VALUE klass, VALUE self, const char *format, ...)
|
36
|
+
NORETURN( static void
|
37
|
+
pg_raise_conn_error( VALUE klass, VALUE self, const char *format, ...))
|
38
38
|
{
|
39
39
|
VALUE msg, error;
|
40
40
|
va_list ap;
|
@@ -515,9 +515,9 @@ static VALUE
|
|
515
515
|
pgconn_connect_poll(VALUE self)
|
516
516
|
{
|
517
517
|
PostgresPollingStatusType status;
|
518
|
-
status = gvl_PQconnectPoll(pg_get_pgconn(self));
|
519
518
|
|
520
519
|
pgconn_close_socket_io(self);
|
520
|
+
status = gvl_PQconnectPoll(pg_get_pgconn(self));
|
521
521
|
|
522
522
|
return INT2FIX((int)status);
|
523
523
|
}
|
@@ -615,9 +615,9 @@ static VALUE
|
|
615
615
|
pgconn_reset_poll(VALUE self)
|
616
616
|
{
|
617
617
|
PostgresPollingStatusType status;
|
618
|
-
status = gvl_PQresetPoll(pg_get_pgconn(self));
|
619
618
|
|
620
619
|
pgconn_close_socket_io(self);
|
620
|
+
status = gvl_PQresetPoll(pg_get_pgconn(self));
|
621
621
|
|
622
622
|
return INT2FIX((int)status);
|
623
623
|
}
|
@@ -2266,6 +2266,17 @@ pgconn_notifies(VALUE self)
|
|
2266
2266
|
return hash;
|
2267
2267
|
}
|
2268
2268
|
|
2269
|
+
#ifndef HAVE_RB_IO_DESCRIPTOR
|
2270
|
+
static int
|
2271
|
+
rb_io_descriptor(VALUE io)
|
2272
|
+
{
|
2273
|
+
Check_Type(io, T_FILE);
|
2274
|
+
rb_io_t *fptr = RFILE(io)->fptr;
|
2275
|
+
rb_io_check_closed(fptr);
|
2276
|
+
return fptr->fd;
|
2277
|
+
}
|
2278
|
+
#endif
|
2279
|
+
|
2269
2280
|
#if defined(_WIN32)
|
2270
2281
|
|
2271
2282
|
/* We use a specialized implementation of rb_io_wait() on Windows.
|
@@ -2286,7 +2297,6 @@ int rb_w32_wait_events( HANDLE *events, int num, DWORD timeout );
|
|
2286
2297
|
|
2287
2298
|
static VALUE
|
2288
2299
|
pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
2289
|
-
rb_io_t *fptr;
|
2290
2300
|
struct timeval ptimeout;
|
2291
2301
|
|
2292
2302
|
struct timeval aborttime={0,0}, currtime, waittime;
|
@@ -2297,7 +2307,6 @@ pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
2297
2307
|
long w32_events = 0;
|
2298
2308
|
DWORD wait_ret;
|
2299
2309
|
|
2300
|
-
GetOpenFile((io), fptr);
|
2301
2310
|
if( !NIL_P(timeout) ){
|
2302
2311
|
ptimeout.tv_sec = (time_t)(NUM2DBL(timeout));
|
2303
2312
|
ptimeout.tv_usec = (time_t)((NUM2DBL(timeout) - (double)ptimeout.tv_sec) * 1e6);
|
@@ -2311,7 +2320,7 @@ pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
2311
2320
|
if(rb_events & PG_RUBY_IO_PRIORITY) w32_events |= FD_OOB;
|
2312
2321
|
|
2313
2322
|
for(;;) {
|
2314
|
-
if ( WSAEventSelect(_get_osfhandle(
|
2323
|
+
if ( WSAEventSelect(_get_osfhandle(rb_io_descriptor(io)), hEvent, w32_events) == SOCKET_ERROR ) {
|
2315
2324
|
WSACloseEvent( hEvent );
|
2316
2325
|
rb_raise( rb_eConnectionBad, "WSAEventSelect socket error: %d", WSAGetLastError() );
|
2317
2326
|
}
|
@@ -2354,7 +2363,7 @@ static VALUE
|
|
2354
2363
|
pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
2355
2364
|
#if defined(HAVE_RUBY_FIBER_SCHEDULER_H)
|
2356
2365
|
/* We don't support Fiber.scheduler on Windows ruby-3.0 because there is no fast way to check whether a scheduler is active.
|
2357
|
-
*
|
2366
|
+
* Fortunately ruby-3.1 offers a C-API for it.
|
2358
2367
|
*/
|
2359
2368
|
VALUE scheduler = rb_fiber_scheduler_current();
|
2360
2369
|
|
@@ -2384,16 +2393,14 @@ typedef enum {
|
|
2384
2393
|
|
2385
2394
|
static VALUE
|
2386
2395
|
pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
2387
|
-
rb_io_t *fptr;
|
2388
2396
|
struct timeval waittime;
|
2389
2397
|
int res;
|
2390
2398
|
|
2391
|
-
GetOpenFile((io), fptr);
|
2392
2399
|
if( !NIL_P(timeout) ){
|
2393
2400
|
waittime.tv_sec = (time_t)(NUM2DBL(timeout));
|
2394
2401
|
waittime.tv_usec = (time_t)((NUM2DBL(timeout) - (double)waittime.tv_sec) * 1e6);
|
2395
2402
|
}
|
2396
|
-
res = rb_wait_for_single_fd(
|
2403
|
+
res = rb_wait_for_single_fd(rb_io_descriptor(io), NUM2UINT(events), NIL_P(timeout) ? NULL : &waittime);
|
2397
2404
|
|
2398
2405
|
return UINT2NUM(res);
|
2399
2406
|
}
|
@@ -3162,7 +3169,7 @@ pgconn_async_get_last_result(VALUE self)
|
|
3162
3169
|
* Returns:
|
3163
3170
|
* * +nil+ when the connection is already idle
|
3164
3171
|
* * +true+ when some results have been discarded
|
3165
|
-
* * +false+ when a failure
|
3172
|
+
* * +false+ when a failure occurred and the connection was closed
|
3166
3173
|
*
|
3167
3174
|
*/
|
3168
3175
|
static VALUE
|
data/ext/pg_copy_coder.c
CHANGED
@@ -235,7 +235,7 @@ pg_text_enc_copy_row(t_pg_coder *conv, VALUE value, char *out, VALUE *intermedia
|
|
235
235
|
char *ptr1;
|
236
236
|
char *ptr2;
|
237
237
|
int strlen;
|
238
|
-
int
|
238
|
+
int backslashes;
|
239
239
|
VALUE subint;
|
240
240
|
VALUE entry;
|
241
241
|
|
@@ -286,19 +286,19 @@ pg_text_enc_copy_row(t_pg_coder *conv, VALUE value, char *out, VALUE *intermedia
|
|
286
286
|
ptr2 = current_out + strlen;
|
287
287
|
|
288
288
|
/* count required backlashs */
|
289
|
-
for(
|
289
|
+
for(backslashes = 0; ptr1 != ptr2; ptr1++) {
|
290
290
|
/* Escape backslash itself, newline, carriage return, and the current delimiter character. */
|
291
291
|
if(*ptr1 == '\\' || *ptr1 == '\n' || *ptr1 == '\r' || *ptr1 == this->delimiter){
|
292
|
-
|
292
|
+
backslashes++;
|
293
293
|
}
|
294
294
|
}
|
295
295
|
|
296
296
|
ptr1 = current_out + strlen;
|
297
|
-
ptr2 = current_out + strlen +
|
297
|
+
ptr2 = current_out + strlen + backslashes;
|
298
298
|
current_out = ptr2;
|
299
299
|
|
300
300
|
/* Then store the escaped string on the final position, walking
|
301
|
-
* right to left, until all
|
301
|
+
* right to left, until all backslashes are placed. */
|
302
302
|
while( ptr1 != ptr2 ) {
|
303
303
|
*--ptr2 = *--ptr1;
|
304
304
|
if(*ptr1 == '\\' || *ptr1 == '\n' || *ptr1 == '\r' || *ptr1 == this->delimiter){
|
@@ -391,7 +391,7 @@ pg_bin_enc_copy_row(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediat
|
|
391
391
|
|
392
392
|
switch(TYPE(entry)){
|
393
393
|
case T_NIL:
|
394
|
-
/* 4 bytes for -1
|
394
|
+
/* 4 bytes for -1 indicating a NULL value */
|
395
395
|
PG_RB_STR_ENSURE_CAPA( *intermediate, 4, current_out, end_capa_ptr );
|
396
396
|
write_nbo32(-1, current_out);
|
397
397
|
current_out += 4;
|
data/ext/pg_record_coder.c
CHANGED
@@ -198,7 +198,7 @@ pg_text_enc_record(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate
|
|
198
198
|
char *ptr1;
|
199
199
|
char *ptr2;
|
200
200
|
long strlen;
|
201
|
-
int
|
201
|
+
int backslashes;
|
202
202
|
VALUE subint;
|
203
203
|
VALUE entry;
|
204
204
|
|
@@ -249,19 +249,19 @@ pg_text_enc_record(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate
|
|
249
249
|
ptr2 = current_out + strlen;
|
250
250
|
|
251
251
|
/* count required backlashs */
|
252
|
-
for(
|
252
|
+
for(backslashes = 0; ptr1 != ptr2; ptr1++) {
|
253
253
|
/* Escape backslash itself, newline, carriage return, and the current delimiter character. */
|
254
254
|
if(*ptr1 == '"' || *ptr1 == '\\'){
|
255
|
-
|
255
|
+
backslashes++;
|
256
256
|
}
|
257
257
|
}
|
258
258
|
|
259
259
|
ptr1 = current_out + strlen;
|
260
|
-
ptr2 = current_out + strlen +
|
260
|
+
ptr2 = current_out + strlen + backslashes;
|
261
261
|
current_out = ptr2;
|
262
262
|
|
263
263
|
/* Then store the escaped string on the final position, walking
|
264
|
-
* right to left, until all
|
264
|
+
* right to left, until all backslashes are placed. */
|
265
265
|
while( ptr1 != ptr2 ) {
|
266
266
|
*--ptr2 = *--ptr1;
|
267
267
|
if(*ptr1 == '"' || *ptr1 == '\\'){
|
data/ext/pg_result.c
CHANGED
@@ -664,7 +664,7 @@ pgresult_verbose_error_message(VALUE self, VALUE verbosity, VALUE show_context)
|
|
664
664
|
* An example:
|
665
665
|
*
|
666
666
|
* begin
|
667
|
-
* conn.exec( "SELECT * FROM
|
667
|
+
* conn.exec( "SELECT * FROM nonexistent_table" )
|
668
668
|
* rescue PG::Error => err
|
669
669
|
* p [
|
670
670
|
* err.result.error_field( PG::Result::PG_DIAG_SEVERITY ),
|
@@ -684,7 +684,7 @@ pgresult_verbose_error_message(VALUE self, VALUE verbosity, VALUE show_context)
|
|
684
684
|
*
|
685
685
|
* Outputs:
|
686
686
|
*
|
687
|
-
* ["ERROR", "42P01", "relation \"
|
687
|
+
* ["ERROR", "42P01", "relation \"nonexistent_table\" does not exist", nil, nil,
|
688
688
|
* "15", nil, nil, nil, "path/to/parse_relation.c", "857", "parserOpenTable"]
|
689
689
|
*/
|
690
690
|
static VALUE
|
data/ext/pg_text_decoder.c
CHANGED
@@ -174,7 +174,7 @@ pg_text_dec_numeric(t_pg_coder *conv, const char *val, int len, int tuple, int f
|
|
174
174
|
static VALUE
|
175
175
|
init_pg_text_decoder_numeric(VALUE rb_mPG_TextDecoder)
|
176
176
|
{
|
177
|
-
|
177
|
+
rb_funcall(rb_mPG, rb_intern("require_bigdecimal_without_warning"), 0);
|
178
178
|
s_id_BigDecimal = rb_intern("BigDecimal");
|
179
179
|
|
180
180
|
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "Numeric", rb_cPG_SimpleDecoder ); */
|
data/ext/pg_text_encoder.c
CHANGED
@@ -377,7 +377,7 @@ init_pg_text_encoder_numeric(VALUE rb_mPG_TextDecoder)
|
|
377
377
|
{
|
378
378
|
s_str_F = rb_str_freeze(rb_str_new_cstr("F"));
|
379
379
|
rb_global_variable(&s_str_F);
|
380
|
-
|
380
|
+
rb_funcall(rb_mPG, rb_intern("require_bigdecimal_without_warning"), 0);
|
381
381
|
s_cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
|
382
382
|
|
383
383
|
/* dummy = rb_define_class_under( rb_mPG_TextEncoder, "Numeric", rb_cPG_SimpleEncoder ); */
|
@@ -437,7 +437,7 @@ quote_array_buffer( void *_this, char *p_in, int strlen, char *p_out ){
|
|
437
437
|
t_pg_composite_coder *this = _this;
|
438
438
|
char *ptr1;
|
439
439
|
char *ptr2;
|
440
|
-
int
|
440
|
+
int backslashes = 0;
|
441
441
|
int needquote;
|
442
442
|
|
443
443
|
/* count data plus backslashes; detect chars needing quotes */
|
@@ -454,7 +454,7 @@ quote_array_buffer( void *_this, char *p_in, int strlen, char *p_out ){
|
|
454
454
|
|
455
455
|
if (ch == '"' || ch == '\\'){
|
456
456
|
needquote = 1;
|
457
|
-
|
457
|
+
backslashes++;
|
458
458
|
} else if (ch == '{' || ch == '}' || ch == this->delimiter ||
|
459
459
|
ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '\v' || ch == '\f'){
|
460
460
|
needquote = 1;
|
@@ -463,12 +463,12 @@ quote_array_buffer( void *_this, char *p_in, int strlen, char *p_out ){
|
|
463
463
|
|
464
464
|
if( needquote ){
|
465
465
|
ptr1 = p_in + strlen;
|
466
|
-
ptr2 = p_out + strlen +
|
466
|
+
ptr2 = p_out + strlen + backslashes + 2;
|
467
467
|
/* Write end quote */
|
468
468
|
*--ptr2 = '"';
|
469
469
|
|
470
470
|
/* Then store the escaped string on the final position, walking
|
471
|
-
* right to left, until all
|
471
|
+
* right to left, until all backslashes are placed. */
|
472
472
|
while( ptr1 != p_in ) {
|
473
473
|
*--ptr2 = *--ptr1;
|
474
474
|
if(*ptr2 == '"' || *ptr2 == '\\'){
|
@@ -477,7 +477,7 @@ quote_array_buffer( void *_this, char *p_in, int strlen, char *p_out ){
|
|
477
477
|
}
|
478
478
|
/* Write start quote */
|
479
479
|
*p_out = '"';
|
480
|
-
return strlen +
|
480
|
+
return strlen + backslashes + 2;
|
481
481
|
} else {
|
482
482
|
if( p_in != p_out )
|
483
483
|
memcpy( p_out, p_in, strlen );
|
@@ -692,22 +692,22 @@ static int
|
|
692
692
|
quote_literal_buffer( void *_this, char *p_in, int strlen, char *p_out ){
|
693
693
|
char *ptr1;
|
694
694
|
char *ptr2;
|
695
|
-
int
|
695
|
+
int backslashes = 0;
|
696
696
|
|
697
697
|
/* count required backlashs */
|
698
698
|
for(ptr1 = p_in; ptr1 != p_in + strlen; ptr1++) {
|
699
699
|
if (*ptr1 == '\''){
|
700
|
-
|
700
|
+
backslashes++;
|
701
701
|
}
|
702
702
|
}
|
703
703
|
|
704
704
|
ptr1 = p_in + strlen;
|
705
|
-
ptr2 = p_out + strlen +
|
705
|
+
ptr2 = p_out + strlen + backslashes + 2;
|
706
706
|
/* Write end quote */
|
707
707
|
*--ptr2 = '\'';
|
708
708
|
|
709
709
|
/* Then store the escaped string on the final position, walking
|
710
|
-
* right to left, until all
|
710
|
+
* right to left, until all backslashes are placed. */
|
711
711
|
while( ptr1 != p_in ) {
|
712
712
|
*--ptr2 = *--ptr1;
|
713
713
|
if(*ptr2 == '\''){
|
@@ -716,7 +716,7 @@ quote_literal_buffer( void *_this, char *p_in, int strlen, char *p_out ){
|
|
716
716
|
}
|
717
717
|
/* Write start quote */
|
718
718
|
*p_out = '\'';
|
719
|
-
return strlen +
|
719
|
+
return strlen + backslashes + 2;
|
720
720
|
}
|
721
721
|
|
722
722
|
|
data/lib/3.1/pg_ext.so
CHANGED
Binary file
|
data/lib/3.2/pg_ext.so
CHANGED
Binary file
|
data/lib/3.3/pg_ext.so
ADDED
Binary file
|
@@ -171,7 +171,14 @@ class PG::BasicTypeRegistry
|
|
171
171
|
include Checker
|
172
172
|
|
173
173
|
def initialize
|
174
|
-
#
|
174
|
+
# @coders_by_name has a content of
|
175
|
+
# Array< Hash< Symbol: Hash< String: Coder > > >
|
176
|
+
#
|
177
|
+
# The layers are:
|
178
|
+
# * index of Array is 0 (text) and 1 (binary)
|
179
|
+
# * Symbol key in the middle Hash is :encoder and :decoder
|
180
|
+
# * String key in the inner Hash corresponds to the `typname` column in the table pg_type
|
181
|
+
# * Coder value in the inner Hash is the associated coder object
|
175
182
|
@coders_by_name = []
|
176
183
|
end
|
177
184
|
|
@@ -226,7 +233,7 @@ class PG::BasicTypeRegistry
|
|
226
233
|
alias_type 0, 'oid', 'int2'
|
227
234
|
|
228
235
|
begin
|
229
|
-
|
236
|
+
PG.require_bigdecimal_without_warning
|
230
237
|
register_type 0, 'numeric', PG::TextEncoder::Numeric, PG::TextDecoder::Numeric
|
231
238
|
rescue LoadError
|
232
239
|
end
|
data/lib/pg/connection.rb
CHANGED
@@ -166,7 +166,10 @@ class PG::Connection
|
|
166
166
|
# conn.put_copy_data ['more', 'data', 'to', 'copy']
|
167
167
|
# end
|
168
168
|
#
|
169
|
-
|
169
|
+
# All 4 CopyRow classes can take a type map to specify how the columns are mapped to and from the database format.
|
170
|
+
# For details see the particular CopyRow class description.
|
171
|
+
#
|
172
|
+
# PG::BinaryEncoder::CopyRow can be used to send data in binary format to the server.
|
170
173
|
# In this case copy_data generates the header and trailer data automatically:
|
171
174
|
# enco = PG::BinaryEncoder::CopyRow.new
|
172
175
|
# conn.copy_data "COPY my_table FROM STDIN (FORMAT binary)", enco do
|
@@ -306,6 +309,11 @@ class PG::Connection
|
|
306
309
|
rollback = false
|
307
310
|
exec "BEGIN"
|
308
311
|
yield(self)
|
312
|
+
rescue PG::RollbackTransaction
|
313
|
+
rollback = true
|
314
|
+
cancel if transaction_status == PG::PQTRANS_ACTIVE
|
315
|
+
block
|
316
|
+
exec "ROLLBACK"
|
309
317
|
rescue Exception
|
310
318
|
rollback = true
|
311
319
|
cancel if transaction_status == PG::PQTRANS_ACTIVE
|
@@ -493,7 +501,7 @@ class PG::Connection
|
|
493
501
|
# See also #copy_data.
|
494
502
|
#
|
495
503
|
def put_copy_data(buffer, encoder=nil)
|
496
|
-
# sync_put_copy_data does a non-blocking
|
504
|
+
# sync_put_copy_data does a non-blocking attempt to flush data.
|
497
505
|
until res=sync_put_copy_data(buffer, encoder)
|
498
506
|
# It didn't flush immediately and allocation of more buffering memory failed.
|
499
507
|
# Wait for all data sent by doing a blocking flush.
|
data/lib/pg/exceptions.rb
CHANGED
@@ -21,5 +21,11 @@ module PG
|
|
21
21
|
class NotInBlockingMode < PG::Error
|
22
22
|
end
|
23
23
|
|
24
|
+
# PG::Connection#transaction uses this exception to distinguish a deliberate rollback from other exceptional situations.
|
25
|
+
# Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception.
|
26
|
+
# But if you raise an PG::RollbackTransaction exception, then the database transaction will be rolled back, without passing on the exception.
|
27
|
+
class RollbackTransaction < StandardError
|
28
|
+
end
|
29
|
+
|
24
30
|
end # module PG
|
25
31
|
|
data/lib/pg/version.rb
CHANGED
data/lib/pg.rb
CHANGED
@@ -126,4 +126,14 @@ module PG
|
|
126
126
|
Warning.extend(TruffleFixWarn)
|
127
127
|
end
|
128
128
|
|
129
|
+
# Ruby-3.4+ prints a warning, if bigdecimal is required but not in the Gemfile.
|
130
|
+
# But it's a false positive, since we enable bigdecimal depending features only if it's available.
|
131
|
+
# And most people don't need these features.
|
132
|
+
def self.require_bigdecimal_without_warning
|
133
|
+
oldverb, $VERBOSE = $VERBOSE, nil
|
134
|
+
require "bigdecimal"
|
135
|
+
ensure
|
136
|
+
$VERBOSE = oldverb
|
137
|
+
end
|
138
|
+
|
129
139
|
end # module PG
|
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.7
|
5
5
|
platform: x64-mingw-ucrt
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
|
35
35
|
5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2024-
|
37
|
+
date: 2024-07-28 00:00:00.000000000 Z
|
38
38
|
dependencies: []
|
39
39
|
description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
|
40
40
|
9.3 and later.
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- ext/vc/pg_19/pg_19.vcproj
|
164
164
|
- lib/3.1/pg_ext.so
|
165
165
|
- lib/3.2/pg_ext.so
|
166
|
+
- lib/3.3/pg_ext.so
|
166
167
|
- lib/pg.rb
|
167
168
|
- lib/pg/basic_type_map_based_on_result.rb
|
168
169
|
- lib/pg/basic_type_map_for_queries.rb
|
@@ -244,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
245
|
version: '3.1'
|
245
246
|
- - "<"
|
246
247
|
- !ruby/object:Gem::Version
|
247
|
-
version: 3.
|
248
|
+
version: 3.4.dev
|
248
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
250
|
requirements:
|
250
251
|
- - ">="
|
metadata.gz.sig
CHANGED
Binary file
|