pg 1.3.0.rc2-x64-mingw-ucrt → 1.3.0.rc3-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5a1b5a2a8f79a93039327534461b65ed194cd9628ee9ae26871379bf74fcc75
4
- data.tar.gz: 556d26471e6629b2d03888d6eb4fe0a588ece95a185357241187da1a0d444d21
3
+ metadata.gz: 8e59ae7755b98c3eada0f2a75207c56cf1ad27a385de83222eab84905ac9ba53
4
+ data.tar.gz: 5cdd62bf34333d6709fe289ceefd692585477d97524dc12af8763e8e4240d724
5
5
  SHA512:
6
- metadata.gz: 78ab92e11247bdfa44578d5779ffd2147fc26b750777a5d0eecc193e0ede67a72110c51991d5e0c89e3f7eb1d02b192bdaadf1e72b0aa37ff53a92919213bff1
7
- data.tar.gz: 939c528b516bffd605c9994821b852fc33678789d6a6605f566a03a2ae7cf012bda6768fe6eee72e8967541dca73479963ba7a2d553face6d7b5b7f80523ac4d
6
+ metadata.gz: bd94425c700174ebee51626564ab42567424191e2c2a789fffe77201616249fa702c6014b92dbd251678170325168289110c7723b2a56cf47f9fa774a082d549
7
+ data.tar.gz: 9c2ff5c001548f7c7f85f64199cbf2648c32029564bd758c99b7b93135894599d75dcc8a8dfd96ffa2e2f893d49ad176dd4d83248b721bd6c6134ba0cfc5c3fb
checksums.yaml.gz.sig CHANGED
Binary file
@@ -113,7 +113,6 @@ jobs:
113
113
  - run: bundle install
114
114
 
115
115
  - run: gem install --local *.gem --verbose
116
- continue-on-error: ${{ matrix.ruby == 'truffleruby-head' }}
117
116
 
118
117
  - name: Run specs
119
118
  continue-on-error: ${{ matrix.ruby == 'truffleruby-head' }}
data/ext/pg_connection.c CHANGED
@@ -968,8 +968,8 @@ static VALUE pgconn_sync_exec_params( int, VALUE *, VALUE );
968
968
  * However #async_exec has two advantages:
969
969
  *
970
970
  * 1. #async_exec can be aborted by signals (like Ctrl-C), while #exec blocks signal processing until the query is answered.
971
- * 2. Ruby VM gets notified about IO blocked operations.
972
- * It can therefore schedule things like garbage collection, while queries are running like in this proposal: https://bugs.ruby-lang.org/issues/14723
971
+ * 2. Ruby VM gets notified about IO blocked operations and can pass them through <tt>Fiber.scheduler</tt>.
972
+ * So only <tt>async_*</tt> methods are compatible to event based schedulers like the async gem.
973
973
  */
974
974
  static VALUE
975
975
  pgconn_sync_exec(int argc, VALUE *argv, VALUE self)
@@ -2208,17 +2208,25 @@ pgconn_notifies(VALUE self)
2208
2208
  }
2209
2209
 
2210
2210
 
2211
- #if !defined(HAVE_RB_IO_WAIT)
2211
+ #if defined(HAVE_RB_IO_WAIT)
2212
+
2213
+ /* Use our own function and constants names, to avoid conflicts with truffleruby-head on its road to ruby-3.0 compatibility. */
2214
+ #define pg_rb_io_wait rb_io_wait
2215
+ #define PG_RUBY_IO_READABLE RUBY_IO_READABLE
2216
+ #define PG_RUBY_IO_WRITABLE RUBY_IO_WRITABLE
2217
+ #define PG_RUBY_IO_PRIORITY RUBY_IO_PRIORITY
2218
+
2219
+ #else
2212
2220
  /* For compat with ruby < 3.0 */
2213
2221
 
2214
2222
  typedef enum {
2215
- RUBY_IO_READABLE = RB_WAITFD_IN,
2216
- RUBY_IO_WRITABLE = RB_WAITFD_OUT,
2217
- RUBY_IO_PRIORITY = RB_WAITFD_PRI,
2218
- } rb_io_event_t;
2223
+ PG_RUBY_IO_READABLE = RB_WAITFD_IN,
2224
+ PG_RUBY_IO_WRITABLE = RB_WAITFD_OUT,
2225
+ PG_RUBY_IO_PRIORITY = RB_WAITFD_PRI,
2226
+ } pg_rb_io_event_t;
2219
2227
 
2220
2228
  static VALUE
2221
- rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
2229
+ pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
2222
2230
  rb_io_t *fptr;
2223
2231
  struct timeval waittime;
2224
2232
  int res;
@@ -2267,7 +2275,7 @@ wait_socket_readable( VALUE self, struct timeval *ptimeout, void *(*is_readable)
2267
2275
  /* Is the given timeout valid? */
2268
2276
  if( !ptimeout || (waittime.tv_sec >= 0 && waittime.tv_usec >= 0) ){
2269
2277
  /* Wait for the socket to become readable before checking again */
2270
- ret = rb_io_wait(socket_io, RB_INT2NUM(RUBY_IO_READABLE), wait_timeout);
2278
+ ret = pg_rb_io_wait(socket_io, RB_INT2NUM(PG_RUBY_IO_READABLE), wait_timeout);
2271
2279
  } else {
2272
2280
  ret = Qfalse;
2273
2281
  }
@@ -2304,9 +2312,9 @@ pgconn_async_flush(VALUE self)
2304
2312
  /* wait for the socket to become read- or write-ready */
2305
2313
  int events;
2306
2314
  VALUE socket_io = pgconn_socket_io(self);
2307
- events = RB_NUM2INT(rb_io_wait(socket_io, RB_INT2NUM(RUBY_IO_READABLE | RUBY_IO_WRITABLE), Qnil));
2315
+ events = RB_NUM2INT(pg_rb_io_wait(socket_io, RB_INT2NUM(PG_RUBY_IO_READABLE | PG_RUBY_IO_WRITABLE), Qnil));
2308
2316
 
2309
- if (events & RUBY_IO_READABLE)
2317
+ if (events & PG_RUBY_IO_READABLE)
2310
2318
  pgconn_consume_input(self);
2311
2319
  }
2312
2320
  return Qtrue;
@@ -3013,10 +3021,10 @@ pgconn_discard_results(VALUE self)
3013
3021
  int status;
3014
3022
 
3015
3023
  /* pgconn_block() raises an exception in case of errors.
3016
- * To avoid this call rb_io_wait() and PQconsumeInput() without rb_raise().
3024
+ * To avoid this call pg_rb_io_wait() and PQconsumeInput() without rb_raise().
3017
3025
  */
3018
3026
  while( gvl_PQisBusy(conn) ){
3019
- rb_io_wait(socket_io, RB_INT2NUM(RUBY_IO_READABLE), Qnil);
3027
+ pg_rb_io_wait(socket_io, RB_INT2NUM(PG_RUBY_IO_READABLE), Qnil);
3020
3028
  if ( PQconsumeInput(conn) == 0 ) {
3021
3029
  pgconn_close_socket_io(self);
3022
3030
  return Qfalse;
@@ -3037,7 +3045,7 @@ pgconn_discard_results(VALUE self)
3037
3045
  int st = gvl_PQgetCopyData(conn, &buffer, 1);
3038
3046
  if( st == 0 ) {
3039
3047
  /* would block -> wait for readable data */
3040
- rb_io_wait(socket_io, RB_INT2NUM(RUBY_IO_READABLE), Qnil);
3048
+ pg_rb_io_wait(socket_io, RB_INT2NUM(PG_RUBY_IO_READABLE), Qnil);
3041
3049
  if ( PQconsumeInput(conn) == 0 ) {
3042
3050
  pgconn_close_socket_io(self);
3043
3051
  return Qfalse;
@@ -3076,6 +3084,7 @@ pgconn_discard_results(VALUE self)
3076
3084
  * #exec is an alias for #async_exec which is almost identical to #sync_exec .
3077
3085
  * #sync_exec is implemented on the simpler synchronous command processing API of libpq, whereas
3078
3086
  * #async_exec is implemented on the asynchronous API and on ruby's IO mechanisms.
3087
+ * Only #async_exec is compatible to <tt>Fiber.scheduler</tt> based asynchronous IO processing introduced in ruby-3.0.
3079
3088
  * Both methods ensure that other threads can process while waiting for the server to
3080
3089
  * complete the request, but #sync_exec blocks all signals to be processed until the query is finished.
3081
3090
  * This is most notably visible by a delayed reaction to Control+C.
data/lib/3.1/pg_ext.so CHANGED
Binary file
data/lib/pg/connection.rb CHANGED
@@ -21,6 +21,13 @@ require 'socket'
21
21
  #
22
22
  # See the PG::Result class for information on working with the results of a query.
23
23
  #
24
+ # Many methods of this class have three variants kind of:
25
+ # 1. #exec - the base method which is an alias to #async_exec .
26
+ # This is the method that should be used in general.
27
+ # 2. #async_exec - the async aware version of the method, implemented by libpq's async API.
28
+ # 3. #sync_exec - the method version that is implemented by blocking function(s) of libpq.
29
+ #
30
+ # Sync and async version of the method can be switched by Connection.async_api= , however it is not recommended to change the default.
24
31
  class PG::Connection
25
32
 
26
33
  # The order the options are passed to the ::connect method.
@@ -690,7 +697,7 @@ class PG::Connection
690
697
  #
691
698
  # Raises a PG::Error if the connection fails.
692
699
  def new(*args, **kwargs)
693
- conn = PG::Connection.connect_start(*args, **kwargs ) or
700
+ conn = self.connect_start(*args, **kwargs ) or
694
701
  raise(PG::Error, "Unable to create a new connection")
695
702
 
696
703
  raise(PG::ConnectionBad, conn.error_message) if conn.status == PG::CONNECTION_BAD
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.3.0.rc2'
3
+ VERSION = '1.3.0.rc3'
4
4
  end
data/lib/pg.rb CHANGED
@@ -63,8 +63,8 @@ module PG
63
63
 
64
64
 
65
65
  ### Convenience alias for PG::Connection.new.
66
- def self::connect( *args )
67
- return PG::Connection.new( *args )
66
+ def self::connect( *args, **kwargs )
67
+ return PG::Connection.new( *args, **kwargs )
68
68
  end
69
69
 
70
70
 
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.3.0.rc2
4
+ version: 1.3.0.rc3
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Michael Granger
@@ -36,7 +36,7 @@ cert_chain:
36
36
  d5T9wAD7jW/0seVujw+76/YOJWO3Dft+FQmMBbdd8s3J47HbN9R2mDt6fl6he+X/
37
37
  gw==
38
38
  -----END CERTIFICATE-----
39
- date: 2022-01-08 00:00:00.000000000 Z
39
+ date: 2022-01-13 00:00:00.000000000 Z
40
40
  dependencies: []
41
41
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
42
42
  9.3 and later.
metadata.gz.sig CHANGED
Binary file