pg 1.3.0.rc3-x86-mingw32 → 1.3.0.rc4-x86-mingw32

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: 5bef00da7bdb5806dec24d5bbf7bae1169e8d68bb03158a0f16869bebf70cab4
4
- data.tar.gz: b9faa4e1655663d53156fb27fa1da4d1435008f3e95d2d88dfc826a7efb60ef0
3
+ metadata.gz: 77f5e29e54f6b610fb98ed5ff7a33ade9766342337903166d7b1f9e4da525bb4
4
+ data.tar.gz: 0be2968011204bbff9bf0a8939bf6f6dd11dfdd0e8a445748336bb6c08ae0eb5
5
5
  SHA512:
6
- metadata.gz: e998da24080f6d3f7b2111eb549f694053539a262fdf131cb1a21be236fe070f03c8fe107faacb46dec3602cdb29e5ec28e64f225b19580ae8503d9d68d3d6c3
7
- data.tar.gz: 9a0610d0323686408b86cf13013ce376de4fcc1629c79ed92f4cf57da0dc11f571978f94b1a97b323b50b538ed95362b383ebf5c3fd979ba50f38a050821e6f5
6
+ metadata.gz: fb17b6305dec8cece32091eabf3b9eb47beb96eb01ec6686ef80144f0f4523132cf9443d3eeb363b61a52875a379d3672b309c8732006973c49dbb1e1c61788d
7
+ data.tar.gz: 5c97874ec1d64ba89c584be5305cf568a01638f56bfe69dd5cb1168af146d4f6823177388bf1fdde117371cbf45927286108582bd7e9a84a988ad7f3800d207e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -79,6 +79,7 @@ jobs:
79
79
  echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
80
80
  echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
81
81
 
82
+ - run: gem update --system
82
83
  - run: bundle install
83
84
  - run: gem install --local pg-*${{ matrix.platform }}.gem --verbose
84
85
  - name: Run specs
@@ -110,6 +110,7 @@ jobs:
110
110
  unzip postgresql-$PGVERSION-binaries.zip && \
111
111
  echo `pwd`/pgsql/bin >> $GITHUB_PATH
112
112
 
113
+ - run: gem update --system
113
114
  - run: bundle install
114
115
 
115
116
  - run: gem install --local *.gem --verbose
data/ext/extconf.rb CHANGED
@@ -155,6 +155,7 @@ have_func 'rb_io_wait' # since ruby-3.0
155
155
  # unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
156
156
  have_header 'unistd.h'
157
157
  have_header 'inttypes.h'
158
+ have_header('ruby/fiber/scheduler.h') if RUBY_PLATFORM=~/mingw|mswin/
158
159
 
159
160
  checking_for "C99 variable length arrays" do
160
161
  $defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
data/ext/pg_connection.c CHANGED
@@ -2207,8 +2207,110 @@ pgconn_notifies(VALUE self)
2207
2207
  return hash;
2208
2208
  }
2209
2209
 
2210
+ #if defined(_WIN32)
2211
+
2212
+ /* We use a specialized implementation of rb_io_wait() on Windows.
2213
+ * This is because rb_io_wait() and rb_wait_for_single_fd() are very slow on Windows.
2214
+ */
2215
+
2216
+ #if defined(HAVE_RUBY_FIBER_SCHEDULER_H)
2217
+ #include <ruby/fiber/scheduler.h>
2218
+ #endif
2219
+
2220
+ typedef enum {
2221
+ PG_RUBY_IO_READABLE = RB_WAITFD_IN,
2222
+ PG_RUBY_IO_WRITABLE = RB_WAITFD_OUT,
2223
+ PG_RUBY_IO_PRIORITY = RB_WAITFD_PRI,
2224
+ } pg_rb_io_event_t;
2225
+
2226
+ int rb_w32_wait_events( HANDLE *events, int num, DWORD timeout );
2227
+
2228
+ static VALUE
2229
+ pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
2230
+ rb_io_t *fptr;
2231
+ struct timeval ptimeout;
2232
+
2233
+ struct timeval aborttime={0,0}, currtime, waittime;
2234
+ DWORD timeout_milisec = INFINITE;
2235
+ HANDLE hEvent = WSACreateEvent();
2236
+
2237
+ long rb_events = NUM2UINT(events);
2238
+ long w32_events = 0;
2239
+ DWORD wait_ret;
2240
+
2241
+ GetOpenFile((io), fptr);
2242
+ if( !NIL_P(timeout) ){
2243
+ ptimeout.tv_sec = (time_t)(NUM2DBL(timeout));
2244
+ ptimeout.tv_usec = (time_t)(NUM2DBL(timeout) - (double)ptimeout.tv_sec);
2245
+
2246
+ gettimeofday(&currtime, NULL);
2247
+ timeradd(&currtime, &ptimeout, &aborttime);
2248
+ }
2249
+
2250
+ if(rb_events & PG_RUBY_IO_READABLE) {
2251
+ w32_events |= FD_READ | FD_ACCEPT | FD_CLOSE;
2252
+ } else if(rb_events & PG_RUBY_IO_WRITABLE) {
2253
+ w32_events |= FD_WRITE | FD_CONNECT;
2254
+ } else if(rb_events & PG_RUBY_IO_PRIORITY) {
2255
+ w32_events |= FD_OOB;
2256
+ }
2257
+
2258
+ for(;;) {
2259
+ if ( WSAEventSelect(_get_osfhandle(fptr->fd), hEvent, w32_events) == SOCKET_ERROR ) {
2260
+ WSACloseEvent( hEvent );
2261
+ rb_raise( rb_eConnectionBad, "WSAEventSelect socket error: %d", WSAGetLastError() );
2262
+ }
2263
+
2264
+ if ( !NIL_P(timeout) ) {
2265
+ gettimeofday(&currtime, NULL);
2266
+ timersub(&aborttime, &currtime, &waittime);
2267
+ timeout_milisec = (DWORD)( waittime.tv_sec * 1e3 + waittime.tv_usec / 1e3 );
2268
+ }
2269
+
2270
+ if( NIL_P(timeout) || (waittime.tv_sec >= 0 && waittime.tv_usec >= 0) ){
2271
+ /* Wait for the socket to become readable before checking again */
2272
+ wait_ret = rb_w32_wait_events( &hEvent, 1, timeout_milisec );
2273
+ } else {
2274
+ wait_ret = WAIT_TIMEOUT;
2275
+ }
2276
+
2277
+ if ( wait_ret == WAIT_TIMEOUT ) {
2278
+ WSACloseEvent( hEvent );
2279
+ return UINT2NUM(0);
2280
+ } else if ( wait_ret == WAIT_OBJECT_0 ) {
2281
+ WSACloseEvent( hEvent );
2282
+ /* The event we were waiting for. */
2283
+ return UINT2NUM(rb_events);
2284
+ } else if ( wait_ret == WAIT_OBJECT_0 + 1) {
2285
+ /* This indicates interruption from timer thread, GC, exception
2286
+ * from other threads etc... */
2287
+ rb_thread_check_ints();
2288
+ } else if ( wait_ret == WAIT_FAILED ) {
2289
+ WSACloseEvent( hEvent );
2290
+ rb_raise( rb_eConnectionBad, "Wait on socket error (WaitForMultipleObjects): %lu", GetLastError() );
2291
+ } else {
2292
+ WSACloseEvent( hEvent );
2293
+ rb_raise( rb_eConnectionBad, "Wait on socket abandoned (WaitForMultipleObjects)" );
2294
+ }
2295
+ }
2296
+ }
2297
+
2298
+ static VALUE
2299
+ pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
2300
+ #if defined(HAVE_RUBY_FIBER_SCHEDULER_H)
2301
+ /* We don't support Fiber.scheduler on Windows ruby-3.0 because there is no fast way to check whether a scheduler is active.
2302
+ * Fortunatelly ruby-3.1 offers a C-API for it.
2303
+ */
2304
+ VALUE scheduler = rb_fiber_scheduler_current();
2305
+
2306
+ if (!NIL_P(scheduler)) {
2307
+ return rb_io_wait(io, events, timeout);
2308
+ }
2309
+ #endif
2310
+ return pg_rb_thread_io_wait(io, events, timeout);
2311
+ }
2210
2312
 
2211
- #if defined(HAVE_RB_IO_WAIT)
2313
+ #elif defined(HAVE_RB_IO_WAIT)
2212
2314
 
2213
2315
  /* Use our own function and constants names, to avoid conflicts with truffleruby-head on its road to ruby-3.0 compatibility. */
2214
2316
  #define pg_rb_io_wait rb_io_wait
@@ -134,7 +134,7 @@ pg_recordcoder_type_map_get(VALUE self)
134
134
  * tm = PG::TypeMapByColumn.new([PG::TextEncoder::Float.new]*2)
135
135
  * # Use this type map to encode the record:
136
136
  * PG::TextEncoder::Record.new(type_map: tm).encode([1,2])
137
- * # => "(\"1.0000000000000000E+00\",\"2.0000000000000000E+00\")"
137
+ * # => "(\"1.0\",\"2.0\")"
138
138
  *
139
139
  * Records can also be encoded and decoded directly to and from the database.
140
140
  * This avoids intermediate string allocations and is very fast.
data/lib/2.5/pg_ext.so CHANGED
Binary file
data/lib/2.6/pg_ext.so CHANGED
Binary file
data/lib/2.7/pg_ext.so CHANGED
Binary file
data/lib/3.0/pg_ext.so CHANGED
Binary file
data/lib/3.1/pg_ext.so CHANGED
Binary file
data/lib/pg/connection.rb CHANGED
@@ -7,7 +7,7 @@ require 'io/wait'
7
7
  require 'socket'
8
8
 
9
9
  # The PostgreSQL connection class. The interface for this class is based on
10
- # {libpq}[http://www.postgresql.org/docs/9.2/interactive/libpq.html], the C
10
+ # {libpq}[http://www.postgresql.org/docs/current/libpq.html], the C
11
11
  # application programmer's interface to PostgreSQL. Some familiarity with libpq
12
12
  # is recommended, but not necessary.
13
13
  #
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.3.0.rc3'
3
+ VERSION = '1.3.0.rc4'
4
4
  end
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.rc3
4
+ version: 1.3.0.rc4
5
5
  platform: x86-mingw32
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-13 00:00:00.000000000 Z
39
+ date: 2022-01-22 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