pgsql 1.5.1 → 1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Rakefile +1 -1
- data/lib/conn.c +3 -2
- data/lib/conn_exec.c +8 -21
- data/lib/conn_quote.c +10 -9
- data/lib/mkrf_conf +7 -15
- data/lib/module.c +1 -1
- data/lib/module.h +3 -9
- data/lib/result.c +0 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5906425e386ca8404df02a1d14dec2ec92e730cabd03c8192f624112d537c3d2
|
4
|
+
data.tar.gz: 5bc40a7923bc2076aef6cdd8a2af71b679f01bee63fed44bbc475bf8e3a12dbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32d74928d3a5c2d04dd30d4453e11a346ce7f4bb24db40665d375776b6caa89dabed59fa87774ab52fdb1d09a9d37e3e8eca13118e04a35572c33c8e827856c
|
7
|
+
data.tar.gz: c405985704ae2c8a1bb52d957965a9b6ad4811bec41fe9785b3c56dba79c463fe1569ab27426a5853bfb1c5dfea4b10ae85505f7944bf5f6cdb6a0595174b895
|
data/lib/Rakefile
CHANGED
data/lib/conn.c
CHANGED
@@ -31,7 +31,7 @@ static VALUE pgconn_init( int argc, VALUE *argv, VALUE self);
|
|
31
31
|
static int set_connect_params( st_data_t key, st_data_t val, st_data_t args);
|
32
32
|
static void connstr_to_hash( VALUE params, VALUE str);
|
33
33
|
static void connstr_passwd( VALUE self, VALUE params);
|
34
|
-
static VALUE connstr_getparam(
|
34
|
+
static VALUE connstr_getparam( RB_BLOCK_CALL_FUNC_ARGLIST( yielded, params));
|
35
35
|
|
36
36
|
static VALUE pgconn_close( VALUE self);
|
37
37
|
static VALUE pgconn_reset( VALUE self);
|
@@ -393,7 +393,8 @@ connstr_passwd( VALUE self, VALUE params)
|
|
393
393
|
}
|
394
394
|
}
|
395
395
|
|
396
|
-
VALUE
|
396
|
+
VALUE
|
397
|
+
connstr_getparam( RB_BLOCK_CALL_FUNC_ARGLIST( yielded, params))
|
397
398
|
{
|
398
399
|
return rb_hash_aref( params, yielded);
|
399
400
|
}
|
data/lib/conn_exec.c
CHANGED
@@ -9,13 +9,6 @@
|
|
9
9
|
#include "result.h"
|
10
10
|
|
11
11
|
|
12
|
-
#ifdef HAVE_FUNC_RB_ERRINFO
|
13
|
-
#define RB_ERRINFO (rb_errinfo())
|
14
|
-
#else
|
15
|
-
#define RB_ERRINFO ruby_errinfo
|
16
|
-
#endif
|
17
|
-
|
18
|
-
|
19
12
|
static void pg_raise_connexec( struct pgconn_data *c);
|
20
13
|
|
21
14
|
static VALUE pg_statement_exec( VALUE conn, VALUE cmd, VALUE par);
|
@@ -37,11 +30,11 @@ static VALUE pgconn_select_values( int argc, VALUE *argv, VALUE self);
|
|
37
30
|
static VALUE pgconn_get_notify( VALUE self);
|
38
31
|
|
39
32
|
static VALUE pgconn_transaction( int argc, VALUE *argv, VALUE self);
|
40
|
-
static VALUE rollback_transaction( VALUE self);
|
33
|
+
static VALUE rollback_transaction( VALUE self, VALUE err);
|
41
34
|
static VALUE commit_transaction( VALUE self);
|
42
35
|
static VALUE yield_transaction( VALUE self);
|
43
36
|
static VALUE pgconn_subtransaction( int argc, VALUE *argv, VALUE self);
|
44
|
-
static VALUE rollback_subtransaction( VALUE ary);
|
37
|
+
static VALUE rollback_subtransaction( VALUE ary, VALUE err);
|
45
38
|
static VALUE release_subtransaction( VALUE ary);
|
46
39
|
static VALUE yield_subtransaction( VALUE ary);
|
47
40
|
static VALUE pgconn_transaction_status( VALUE self);
|
@@ -166,8 +159,6 @@ free_strings( char **strs, int len)
|
|
166
159
|
void
|
167
160
|
pg_parse_parameters( int argc, VALUE *argv, VALUE *cmd, VALUE *par)
|
168
161
|
{
|
169
|
-
int len;
|
170
|
-
|
171
162
|
rb_scan_args( argc, argv, "1*", cmd, par);
|
172
163
|
StringValue( *cmd);
|
173
164
|
if (RARRAY_LEN( *par) <= 0)
|
@@ -244,7 +235,6 @@ pgconn_fetch( VALUE self)
|
|
244
235
|
{
|
245
236
|
struct pgconn_data *c;
|
246
237
|
PGresult *result;
|
247
|
-
VALUE res;
|
248
238
|
|
249
239
|
Data_Get_Struct( self, struct pgconn_data, c);
|
250
240
|
pg_check_conninvalid( c);
|
@@ -260,9 +250,6 @@ pgconn_fetch( VALUE self)
|
|
260
250
|
VALUE
|
261
251
|
yield_or_return_result( VALUE result)
|
262
252
|
{
|
263
|
-
struct pgresult_data *r;
|
264
|
-
|
265
|
-
Data_Get_Struct( result, struct pgresult_data, r);
|
266
253
|
return rb_block_given_p() ?
|
267
254
|
rb_ensure( rb_yield, result, pgresult_clear, result) : result;
|
268
255
|
}
|
@@ -472,10 +459,10 @@ yield_transaction( VALUE self)
|
|
472
459
|
}
|
473
460
|
|
474
461
|
VALUE
|
475
|
-
rollback_transaction( VALUE self)
|
462
|
+
rollback_transaction( VALUE self, VALUE err)
|
476
463
|
{
|
477
464
|
pgresult_clear( pg_statement_exec( self, rb_str_new2( "ROLLBACK;"), Qnil));
|
478
|
-
rb_exc_raise(
|
465
|
+
rb_exc_raise( err);
|
479
466
|
return Qnil;
|
480
467
|
}
|
481
468
|
|
@@ -533,7 +520,7 @@ yield_subtransaction( VALUE ary)
|
|
533
520
|
}
|
534
521
|
|
535
522
|
VALUE
|
536
|
-
rollback_subtransaction( VALUE ary)
|
523
|
+
rollback_subtransaction( VALUE ary, VALUE err)
|
537
524
|
{
|
538
525
|
VALUE cmd;
|
539
526
|
|
@@ -542,7 +529,7 @@ rollback_subtransaction( VALUE ary)
|
|
542
529
|
rb_str_buf_cat2( cmd, ";");
|
543
530
|
pgresult_clear( pg_statement_exec( rb_ary_entry( ary, 0), cmd, Qnil));
|
544
531
|
rb_ary_store( ary, 1, Qnil);
|
545
|
-
rb_exc_raise(
|
532
|
+
rb_exc_raise( err);
|
546
533
|
return Qnil;
|
547
534
|
}
|
548
535
|
|
@@ -625,7 +612,7 @@ put_end( VALUE self)
|
|
625
612
|
Data_Get_Struct( self, struct pgconn_data, c);
|
626
613
|
/*
|
627
614
|
* I would like to hand over something like
|
628
|
-
* RSTRING_PTR( rb_obj_as_string(
|
615
|
+
* RSTRING_PTR( rb_obj_as_string( rb_errinfo()))
|
629
616
|
* here but when execution is inside a rescue block
|
630
617
|
* the error info will be non-null even though the
|
631
618
|
* exception just has been caught.
|
@@ -908,6 +895,6 @@ Init_pgsql_conn_exec( void)
|
|
908
895
|
|
909
896
|
rb_define_method( rb_cPgConn, "backup", &pgconn_backup, 1);
|
910
897
|
|
911
|
-
|
898
|
+
id_to_a = 0;
|
912
899
|
}
|
913
900
|
|
data/lib/conn_quote.c
CHANGED
@@ -23,7 +23,8 @@ extern VALUE pgconn_for_copy( VALUE self, VALUE str);
|
|
23
23
|
static int needs_dquote_string( VALUE str);
|
24
24
|
static VALUE dquote_string( VALUE str);
|
25
25
|
static VALUE stringize_array( VALUE self, VALUE result, VALUE ary);
|
26
|
-
static VALUE gsub_escape_i(
|
26
|
+
static VALUE gsub_escape_i( RB_BLOCK_CALL_FUNC_ARGLIST( c, arg));
|
27
|
+
|
27
28
|
|
28
29
|
static VALUE pgconn_quote( VALUE self, VALUE obj);
|
29
30
|
static VALUE pgconn_quote_all( int argc, VALUE *argv, VALUE self);
|
@@ -199,11 +200,11 @@ pgconn_unescape_bytea( VALUE self, VALUE obj)
|
|
199
200
|
size_t l;
|
200
201
|
VALUE ret;
|
201
202
|
|
202
|
-
if (NIL_P( obj))
|
203
|
-
return Qnil;
|
204
203
|
#ifdef RUBY_ENCODING
|
205
204
|
rb_scan_args( argc, argv, "11", &obj, &enc);
|
206
205
|
#endif
|
206
|
+
if (NIL_P( obj))
|
207
|
+
return Qnil;
|
207
208
|
StringValue( obj);
|
208
209
|
|
209
210
|
s = PQunescapeBytea( (unsigned char *) RSTRING_PTR( obj), &l);
|
@@ -319,7 +320,7 @@ pgconn_stringize_line( VALUE self, VALUE ary)
|
|
319
320
|
VALUE a;
|
320
321
|
VALUE *p;
|
321
322
|
int l;
|
322
|
-
VALUE ret
|
323
|
+
VALUE ret;
|
323
324
|
|
324
325
|
a = rb_check_convert_type( ary, T_ARRAY, "Array", "to_ary");
|
325
326
|
if (NIL_P(a))
|
@@ -411,13 +412,13 @@ dquote_string( VALUE str)
|
|
411
412
|
VALUE
|
412
413
|
stringize_array( VALUE self, VALUE result, VALUE ary)
|
413
414
|
{
|
414
|
-
long i
|
415
|
+
long i;
|
415
416
|
VALUE *o;
|
416
417
|
VALUE cf, co;
|
417
418
|
VALUE r;
|
418
419
|
|
419
420
|
cf = Qundef;
|
420
|
-
for (o = RARRAY_PTR( ary),
|
421
|
+
for (o = RARRAY_PTR( ary), i = RARRAY_LEN( ary); i; ++o, --i) {
|
421
422
|
co = CLASS_OF( *o);
|
422
423
|
if (cf == Qundef)
|
423
424
|
cf = co;
|
@@ -438,7 +439,7 @@ stringize_array( VALUE self, VALUE result, VALUE ary)
|
|
438
439
|
|
439
440
|
|
440
441
|
VALUE
|
441
|
-
gsub_escape_i(
|
442
|
+
gsub_escape_i( RB_BLOCK_CALL_FUNC_ARGLIST( c, arg))
|
442
443
|
{
|
443
444
|
const char *r;
|
444
445
|
|
@@ -584,12 +585,12 @@ quote_string( VALUE conn, VALUE str)
|
|
584
585
|
VALUE
|
585
586
|
quote_array( VALUE self, VALUE result, VALUE ary)
|
586
587
|
{
|
587
|
-
long i
|
588
|
+
long i;
|
588
589
|
VALUE *o;
|
589
590
|
VALUE cf, co;
|
590
591
|
|
591
592
|
cf = Qundef;
|
592
|
-
for (o = RARRAY_PTR( ary),
|
593
|
+
for (o = RARRAY_PTR( ary), i = RARRAY_LEN( ary); i; ++o, --i) {
|
593
594
|
co = CLASS_OF( *o);
|
594
595
|
if (cf == Qundef)
|
595
596
|
cf = co;
|
data/lib/mkrf_conf
CHANGED
@@ -10,27 +10,19 @@ Autorake.configure {
|
|
10
10
|
|
11
11
|
extending_ruby
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
have_header "st.h"
|
17
|
-
else
|
18
|
-
have_header "ruby/ruby.h"
|
19
|
-
have_header "ruby/io.h"
|
20
|
-
end
|
13
|
+
need_header "ruby/ruby.h"
|
14
|
+
need_header "ruby/io.h"
|
15
|
+
|
21
16
|
|
22
17
|
incdir :postgres, `pg_config --pkgincludedir`
|
23
18
|
incdir :postgres_server, `pg_config --includedir-server`
|
24
19
|
|
25
|
-
|
26
|
-
have_library "ssl"
|
27
|
-
have_library "pq"
|
20
|
+
need_library "pq"
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
need_header "postgres.h"
|
23
|
+
need_header "libpq-fe.h"
|
24
|
+
need_header "catalog/pg_type.h"
|
32
25
|
|
33
|
-
have_func "rb_errinfo"
|
34
26
|
have_func "rb_io_stdio_file"
|
35
27
|
have_func "rb_locale_encoding"
|
36
28
|
|
data/lib/module.c
CHANGED
data/lib/module.h
CHANGED
@@ -18,15 +18,9 @@
|
|
18
18
|
#endif
|
19
19
|
#include "undef.h"
|
20
20
|
|
21
|
-
#
|
22
|
-
|
23
|
-
#
|
24
|
-
#ifdef HAVE_HEADER_LIBPQ_FE_H
|
25
|
-
#include <libpq-fe.h>
|
26
|
-
#endif
|
27
|
-
#ifdef HAVE_HEADER_CATALOG_PG_TYPE_H
|
28
|
-
#include <catalog/pg_type.h>
|
29
|
-
#endif
|
21
|
+
#include <postgres.h>
|
22
|
+
#include <libpq-fe.h>
|
23
|
+
#include <catalog/pg_type.h>
|
30
24
|
#include "undef.h"
|
31
25
|
|
32
26
|
|
data/lib/result.c
CHANGED
@@ -11,9 +11,6 @@
|
|
11
11
|
static void pgresult_init( struct pgresult_data *r, PGresult *result, struct pgconn_data *conn);
|
12
12
|
static VALUE pgreserror_new( VALUE result, VALUE cmd, VALUE par);
|
13
13
|
|
14
|
-
static VALUE pgreserror_command( VALUE self);
|
15
|
-
static VALUE pgreserror_params( VALUE self);
|
16
|
-
|
17
14
|
static struct pgresult_data *pgreserror_result( VALUE self);
|
18
15
|
static VALUE pgreserror_status( VALUE self);
|
19
16
|
static VALUE pgreserror_sqlst( VALUE self);
|
@@ -25,7 +22,6 @@ static VALUE pgreserror_diag( VALUE self, VALUE field);
|
|
25
22
|
|
26
23
|
static VALUE pgresult_s_translate_results_set( VALUE cls, VALUE fact);
|
27
24
|
|
28
|
-
static void pgresult_mark( struct pgresult_data *ptr);
|
29
25
|
static void pgresult_free( struct pgresult_data *ptr);
|
30
26
|
extern VALUE pgresult_new( PGresult *result, struct pgconn_data *conn, VALUE cmd, VALUE par);
|
31
27
|
|
@@ -214,13 +210,6 @@ pgresult_s_translate_results_set( VALUE cls, VALUE fact)
|
|
214
210
|
|
215
211
|
|
216
212
|
|
217
|
-
void
|
218
|
-
pgresult_mark( struct pgresult_data *ptr)
|
219
|
-
{
|
220
|
-
rb_gc_mark( ptr->fields);
|
221
|
-
rb_gc_mark( ptr->indices);
|
222
|
-
}
|
223
|
-
|
224
213
|
void
|
225
214
|
pgresult_free( struct pgresult_data *ptr)
|
226
215
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autorake
|
@@ -55,7 +55,7 @@ homepage: http://www.bertram-scharpf.de/software/pgsql
|
|
55
55
|
licenses:
|
56
56
|
- BSD-2-Clause
|
57
57
|
metadata: {}
|
58
|
-
post_install_message:
|
58
|
+
post_install_message:
|
59
59
|
rdoc_options:
|
60
60
|
- "--main"
|
61
61
|
- README
|
@@ -73,8 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements:
|
75
75
|
- PostgreSQL
|
76
|
-
rubygems_version: 3.0.
|
77
|
-
signing_key:
|
76
|
+
rubygems_version: 3.0.8
|
77
|
+
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: PostgreSQL-API for Ruby
|
80
80
|
test_files: []
|