pg 1.1.2-x86-mingw32 → 1.1.3-x86-mingw32
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.tar.gz.sig +0 -0
- data/History.rdoc +5 -0
- data/ext/pg.h +0 -3
- data/ext/pg_connection.c +18 -20
- data/lib/2.0/pg_ext.so +0 -0
- data/lib/2.1/pg_ext.so +0 -0
- data/lib/2.2/pg_ext.so +0 -0
- data/lib/2.3/pg_ext.so +0 -0
- data/lib/2.4/pg_ext.so +0 -0
- data/lib/2.5/pg_ext.so +0 -0
- data/lib/libpq.dll +0 -0
- data/lib/pg.rb +2 -2
- data/spec/pg/connection_spec.rb +31 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c86ddfcf7b79e6cf6d872926775db949011d45f
|
4
|
+
data.tar.gz: 05b496d93f220caf5426fae5457e7921d0e0315c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fc423e112b1867180daf407b9c00a0131b5f57dc4bfa8496e6f5390f5444de160625a82d6f7f6c63cc1a43ad98e973db73ffa625b17861ff0bacaa3f54e7870
|
7
|
+
data.tar.gz: ab17b5437b6bf1802b80dadaa8be8c3ac29f26de41a8889d6b5f1fd3672dc83dd69e5310264a311fa44da627fb083ce840a1eda5b75c8d709da1e108b749a9b5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/ext/pg.h
CHANGED
@@ -101,9 +101,6 @@ typedef struct {
|
|
101
101
|
/* Kind of PG::Coder object for casting COPY rows to ruby values */
|
102
102
|
VALUE decoder_for_get_copy_data;
|
103
103
|
|
104
|
-
/* The connection socket, used for rb_wait_for_single_fd() */
|
105
|
-
int socket;
|
106
|
-
|
107
104
|
/* enable/disable guessing size of PGresult's allocated memory */
|
108
105
|
int guess_result_memsize;
|
109
106
|
} t_pg_connection;
|
data/ext/pg_connection.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg_connection.c - PG::Connection class extension
|
3
|
-
* $Id: pg_connection.c,v
|
3
|
+
* $Id: pg_connection.c,v b49f54dc755b 2018/09/01 12:52:41 lars $
|
4
4
|
*
|
5
5
|
*/
|
6
6
|
|
@@ -198,7 +198,6 @@ pgconn_s_allocate( VALUE klass )
|
|
198
198
|
this->decoder_for_get_copy_data = Qnil;
|
199
199
|
this->trace_stream = Qnil;
|
200
200
|
this->external_encoding = Qnil;
|
201
|
-
this->socket = -1;
|
202
201
|
this->guess_result_memsize = 1;
|
203
202
|
|
204
203
|
return self;
|
@@ -272,6 +271,7 @@ pgconn_init(int argc, VALUE *argv, VALUE self)
|
|
272
271
|
this = pg_get_connection( self );
|
273
272
|
conninfo = rb_funcall2( rb_cPGconn, rb_intern("parse_connect_args"), argc, argv );
|
274
273
|
this->pgconn = gvl_PQconnectdb(StringValueCStr(conninfo));
|
274
|
+
|
275
275
|
if(this->pgconn == NULL)
|
276
276
|
rb_raise(rb_ePGerror, "PQconnectdb() unable to allocate structure");
|
277
277
|
|
@@ -281,10 +281,6 @@ pgconn_init(int argc, VALUE *argv, VALUE self)
|
|
281
281
|
rb_exc_raise(error);
|
282
282
|
}
|
283
283
|
|
284
|
-
this->socket = PQsocket( this->pgconn );
|
285
|
-
if ( this->socket < 0 )
|
286
|
-
rb_raise(rb_eConnectionBad, "PQsocket() can't get socket descriptor");
|
287
|
-
|
288
284
|
pgconn_set_default_encoding( self );
|
289
285
|
|
290
286
|
if (rb_block_given_p()) {
|
@@ -335,10 +331,6 @@ pgconn_s_connect_start( int argc, VALUE *argv, VALUE klass )
|
|
335
331
|
rb_exc_raise(error);
|
336
332
|
}
|
337
333
|
|
338
|
-
this->socket = PQsocket( this->pgconn );
|
339
|
-
if ( this->socket < 0 )
|
340
|
-
rb_raise(rb_eConnectionBad, "PQsocket() can't get socket descriptor");
|
341
|
-
|
342
334
|
if ( rb_block_given_p() ) {
|
343
335
|
return rb_ensure( rb_yield, rb_conn, pgconn_finish, rb_conn );
|
344
336
|
}
|
@@ -2337,15 +2329,18 @@ pgconn_notifies(VALUE self)
|
|
2337
2329
|
int rb_w32_wait_events( HANDLE *events, int num, DWORD timeout );
|
2338
2330
|
|
2339
2331
|
static void *
|
2340
|
-
wait_socket_readable(
|
2332
|
+
wait_socket_readable( PGconn *conn, struct timeval *ptimeout, void *(*is_readable)(PGconn *) )
|
2341
2333
|
{
|
2342
|
-
|
2334
|
+
int sd = PQsocket( conn );
|
2343
2335
|
void *retval;
|
2344
2336
|
struct timeval aborttime={0,0}, currtime, waittime;
|
2345
2337
|
DWORD timeout_milisec = INFINITE;
|
2346
2338
|
DWORD wait_ret;
|
2347
2339
|
WSAEVENT hEvent;
|
2348
2340
|
|
2341
|
+
if ( sd < 0 )
|
2342
|
+
rb_raise(rb_eConnectionBad, "PQsocket() can't get socket descriptor");
|
2343
|
+
|
2349
2344
|
hEvent = WSACreateEvent();
|
2350
2345
|
|
2351
2346
|
/* Check for connection errors (PQisBusy is true on connection errors) */
|
@@ -2360,7 +2355,7 @@ wait_socket_readable( t_pg_connection *this, struct timeval *ptimeout, void *(*i
|
|
2360
2355
|
}
|
2361
2356
|
|
2362
2357
|
while ( !(retval=is_readable(conn)) ) {
|
2363
|
-
if ( WSAEventSelect(
|
2358
|
+
if ( WSAEventSelect(sd, hEvent, FD_READ|FD_CLOSE) == SOCKET_ERROR ) {
|
2364
2359
|
WSACloseEvent( hEvent );
|
2365
2360
|
rb_raise( rb_eConnectionBad, "WSAEventSelect socket error: %d", WSAGetLastError() );
|
2366
2361
|
}
|
@@ -2412,13 +2407,16 @@ wait_socket_readable( t_pg_connection *this, struct timeval *ptimeout, void *(*i
|
|
2412
2407
|
/* non Win32 */
|
2413
2408
|
|
2414
2409
|
static void *
|
2415
|
-
wait_socket_readable(
|
2410
|
+
wait_socket_readable( PGconn *conn, struct timeval *ptimeout, void *(*is_readable)(PGconn *))
|
2416
2411
|
{
|
2417
|
-
|
2412
|
+
int sd = PQsocket( conn );
|
2418
2413
|
int ret;
|
2419
2414
|
void *retval;
|
2420
2415
|
struct timeval aborttime={0,0}, currtime, waittime;
|
2421
2416
|
|
2417
|
+
if ( sd < 0 )
|
2418
|
+
rb_raise(rb_eConnectionBad, "PQsocket() can't get socket descriptor");
|
2419
|
+
|
2422
2420
|
/* Check for connection errors (PQisBusy is true on connection errors) */
|
2423
2421
|
if ( PQconsumeInput(conn) == 0 )
|
2424
2422
|
rb_raise( rb_eConnectionBad, "PQconsumeInput() %s", PQerrorMessage(conn) );
|
@@ -2437,7 +2435,7 @@ wait_socket_readable( t_pg_connection *this, struct timeval *ptimeout, void *(*i
|
|
2437
2435
|
/* Is the given timeout valid? */
|
2438
2436
|
if( !ptimeout || (waittime.tv_sec >= 0 && waittime.tv_usec >= 0) ){
|
2439
2437
|
/* Wait for the socket to become readable before checking again */
|
2440
|
-
ret = rb_wait_for_single_fd(
|
2438
|
+
ret = rb_wait_for_single_fd( sd, RB_WAITFD_IN, ptimeout ? &waittime : NULL );
|
2441
2439
|
} else {
|
2442
2440
|
ret = 0;
|
2443
2441
|
}
|
@@ -2484,7 +2482,7 @@ notify_readable(PGconn *conn)
|
|
2484
2482
|
static VALUE
|
2485
2483
|
pgconn_wait_for_notify(int argc, VALUE *argv, VALUE self)
|
2486
2484
|
{
|
2487
|
-
|
2485
|
+
PGconn *conn = pg_get_pgconn( self );
|
2488
2486
|
PGnotify *pnotification;
|
2489
2487
|
struct timeval timeout;
|
2490
2488
|
struct timeval *ptimeout = NULL;
|
@@ -2500,7 +2498,7 @@ pgconn_wait_for_notify(int argc, VALUE *argv, VALUE self)
|
|
2500
2498
|
ptimeout = &timeout;
|
2501
2499
|
}
|
2502
2500
|
|
2503
|
-
pnotification = (PGnotify*) wait_socket_readable(
|
2501
|
+
pnotification = (PGnotify*) wait_socket_readable( conn, ptimeout, notify_readable);
|
2504
2502
|
|
2505
2503
|
/* Return nil if the select timed out */
|
2506
2504
|
if ( !pnotification ) return Qnil;
|
@@ -3078,7 +3076,7 @@ get_result_readable(PGconn *conn)
|
|
3078
3076
|
*/
|
3079
3077
|
static VALUE
|
3080
3078
|
pgconn_block( int argc, VALUE *argv, VALUE self ) {
|
3081
|
-
|
3079
|
+
PGconn *conn = pg_get_pgconn( self );
|
3082
3080
|
|
3083
3081
|
struct timeval timeout;
|
3084
3082
|
struct timeval *ptimeout = NULL;
|
@@ -3093,7 +3091,7 @@ pgconn_block( int argc, VALUE *argv, VALUE self ) {
|
|
3093
3091
|
ptimeout = &timeout;
|
3094
3092
|
}
|
3095
3093
|
|
3096
|
-
ret = wait_socket_readable(
|
3094
|
+
ret = wait_socket_readable( conn, ptimeout, get_result_readable);
|
3097
3095
|
|
3098
3096
|
if( !ret )
|
3099
3097
|
return Qfalse;
|
data/lib/2.0/pg_ext.so
CHANGED
Binary file
|
data/lib/2.1/pg_ext.so
CHANGED
Binary file
|
data/lib/2.2/pg_ext.so
CHANGED
Binary file
|
data/lib/2.3/pg_ext.so
CHANGED
Binary file
|
data/lib/2.4/pg_ext.so
CHANGED
Binary file
|
data/lib/2.5/pg_ext.so
CHANGED
Binary file
|
data/lib/libpq.dll
CHANGED
Binary file
|
data/lib/pg.rb
CHANGED
data/spec/pg/connection_spec.rb
CHANGED
@@ -228,6 +228,22 @@ describe PG::Connection do
|
|
228
228
|
|
229
229
|
res = @conn2.query("SELECT 4")
|
230
230
|
end
|
231
|
+
|
232
|
+
it "can use conn.reset_start to restart the connection" do
|
233
|
+
ios = IO.pipe
|
234
|
+
conn = described_class.connect_start( @conninfo )
|
235
|
+
wait_for_polling_ok(conn)
|
236
|
+
|
237
|
+
# Close the two pipe file descriptors, so that the file descriptor of
|
238
|
+
# newly established connection is probably distinct from the previous one.
|
239
|
+
ios.each(&:close)
|
240
|
+
conn.reset_start
|
241
|
+
wait_for_polling_ok(conn)
|
242
|
+
|
243
|
+
# The new connection should work even when the file descriptor has changed.
|
244
|
+
expect( conn.exec("SELECT 1").values ).to eq([["1"]])
|
245
|
+
conn.close
|
246
|
+
end
|
231
247
|
end
|
232
248
|
|
233
249
|
it "raises proper error when sending fails" do
|
@@ -914,6 +930,20 @@ describe PG::Connection do
|
|
914
930
|
expect { conn.finish }.to raise_error( PG::ConnectionBad, /connection is closed/i )
|
915
931
|
end
|
916
932
|
|
933
|
+
it "can use conn.reset to restart the connection" do
|
934
|
+
ios = IO.pipe
|
935
|
+
conn = PG.connect( @conninfo )
|
936
|
+
|
937
|
+
# Close the two pipe file descriptors, so that the file descriptor of
|
938
|
+
# newly established connection is probably distinct from the previous one.
|
939
|
+
ios.each(&:close)
|
940
|
+
conn.reset
|
941
|
+
|
942
|
+
# The new connection should work even when the file descriptor has changed.
|
943
|
+
expect( conn.exec("SELECT 1").values ).to eq([["1"]])
|
944
|
+
conn.close
|
945
|
+
end
|
946
|
+
|
917
947
|
it "closes the IO fetched from #socket_io when the connection is closed", :without_transaction, :socket_io do
|
918
948
|
conn = PG.connect( @conninfo )
|
919
949
|
io = conn.socket_io
|
@@ -939,7 +969,7 @@ describe PG::Connection do
|
|
939
969
|
end
|
940
970
|
serv.close
|
941
971
|
expect{ conn.block }.to raise_error(PG::ConnectionBad, /server closed the connection unexpectedly/)
|
942
|
-
expect{ conn.block }.to raise_error(PG::ConnectionBad, /
|
972
|
+
expect{ conn.block }.to raise_error(PG::ConnectionBad, /can't get socket descriptor/)
|
943
973
|
end
|
944
974
|
|
945
975
|
it "sets the fallback_application_name on new connections" do
|
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.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
|
37
37
|
OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2018-
|
39
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe-mercurial
|
metadata.gz.sig
CHANGED
Binary file
|