pgsql 1.9.3 → 1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +31 -8
- data/README.md +57 -0
- data/lib/conn.c +0 -5
- data/lib/conn_exec.c +18 -35
- data/lib/conn_quote.c +2 -5
- data/lib/module.c +1 -1
- data/lib/result.c +0 -6
- metadata +10 -13
- data/README +0 -48
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5e250aaea34af2f5b9f76ebb8d6ef7d590836e8826dd189ef9c1721a8aced6b
|
|
4
|
+
data.tar.gz: e24f7f58eb083c0c95c544ac72ed17c8423759fc335798ce8957e8c085262fab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62aea91052765eb84cbedae7140e05574cc919eb53a18123a5b9818f58cd188b7bad70c17ebb175019056db33f46da6c810fd1483b78694680338a51cd88ba37
|
|
7
|
+
data.tar.gz: 86eb5356770eea1bbd0a66151f49ba61d6c221a4cdfcc2f86d11c5982c6fe6adc9d0d0a41ca9d128bd2796c07c40a0305d6828be80df509b0b933bc765bbeac8
|
data/LICENSE
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
# BSD-2-clause license, extended by language use conditions
|
|
2
2
|
|
|
3
|
-
Copyright (C) 2011-
|
|
3
|
+
Copyright (C) 2011-2025, Bertram Scharpf <software@bertram-scharpf.de>.
|
|
4
4
|
All rights reserved.
|
|
5
5
|
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
|
7
7
|
modification, are permitted provided that the following conditions are
|
|
8
8
|
met:
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Redistributions of source code must retain the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
notice, this list of conditions and the following disclaimer in
|
|
15
|
+
the documentation and/or other materials provided with the
|
|
16
|
+
distribution.
|
|
17
|
+
|
|
18
|
+
* Redistributions must not contain any clauses about anticipated
|
|
19
|
+
harassment or discrimination, nor must they be held in a so-called
|
|
20
|
+
"inclusive language". As far as German language is used, the
|
|
21
|
+
conditions mentioned below additionally apply.
|
|
17
22
|
|
|
18
23
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
19
24
|
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
@@ -27,3 +32,21 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
27
32
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
28
33
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
34
|
|
|
35
|
+
|
|
36
|
+
## Use of the German Language
|
|
37
|
+
|
|
38
|
+
Beim Gebrauch deutscher Sprache sind Weiterentwicklungen und
|
|
39
|
+
-verbreitungen nur gestattet unter Einhaltung sowie abermaligen
|
|
40
|
+
Einforderns folgender zusätzlicher Bedingungen:
|
|
41
|
+
|
|
42
|
+
* Keine Verwendung von sogenannter „geschlechtergerechter Sprache“,
|
|
43
|
+
also Anfügen von weiblichen Endungen mit Binnen-I, Sternchen,
|
|
44
|
+
Doppelpunkt, Unterstrich oder ähnlichem, oder Konstruktionen, die
|
|
45
|
+
den Sachverhalt falsch wiedergeben („Radfahrende“, „Studierende“).
|
|
46
|
+
|
|
47
|
+
* Keine Verwendung der „reformierten Rechtschreibung“ von 1996,
|
|
48
|
+
insbesondere Doppel-S am Silbenende, „plazieren“ mit T, sowie
|
|
49
|
+
Großschreibung von Wendungen wie „des weiteren“.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<!-- vim:set ft=markdown : -->
|
data/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# pgsql Ruby Gem
|
|
2
|
+
|
|
3
|
+
A PostgreSQL library that was carefully designed.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Author
|
|
7
|
+
|
|
8
|
+
Bertram Scharpf <software@bertram-scharpf.de>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* Connection parameters from hash
|
|
14
|
+
* Query parameters
|
|
15
|
+
* Asynchronous queries
|
|
16
|
+
* Quick query of single lines or values
|
|
17
|
+
* Full PostgreSQL quoting support
|
|
18
|
+
* Built-in transactions and savepoints by Ruby blocks
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
Write something like this:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require "pgsql"
|
|
27
|
+
|
|
28
|
+
Pg::Conn.open :dbname => "test1", :user => "jdoe" do |conn|
|
|
29
|
+
conn.exec "SELECT * FROM mytable;" do |result|
|
|
30
|
+
result.each { |row|
|
|
31
|
+
l = row.join ", "
|
|
32
|
+
...
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
cmd = <<~ENDSQL
|
|
36
|
+
SELECT * FROM mytable WHERE num=$1::INTEGER;
|
|
37
|
+
ENDSQL
|
|
38
|
+
conn.query cmd, 42 do |row|
|
|
39
|
+
l = row.join ", "
|
|
40
|
+
...
|
|
41
|
+
end
|
|
42
|
+
...
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Thanks
|
|
48
|
+
|
|
49
|
+
In the remembrance of Guy Decoux.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Copyright
|
|
53
|
+
|
|
54
|
+
* (C) 2011-2025 Bertram Scharpf <software@bertram-scharpf.de>
|
|
55
|
+
* License: [BSD-2-Clause+](./LICENSE)
|
|
56
|
+
* Repository: [ruby-pgsql](https://github.com/BertramScharpf/ruby-pgsql)
|
|
57
|
+
|
data/lib/conn.c
CHANGED
|
@@ -13,18 +13,13 @@
|
|
|
13
13
|
#endif
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
extern void pg_check_conninvalid( struct pgconn_data *c);
|
|
17
16
|
static VALUE pgconnfailederror_new( struct pgconn_data *c, VALUE params);
|
|
18
17
|
|
|
19
18
|
static void pgconn_mark( void *ptr);
|
|
20
19
|
static void pgconn_free( void *ptr);
|
|
21
20
|
static size_t pgconn_memsize( const void *ptr);
|
|
22
|
-
extern struct pgconn_data *get_pgconn( VALUE obj);
|
|
23
21
|
static VALUE pgconn_encode_in4out( struct pgconn_data *ptr, VALUE str);
|
|
24
|
-
extern const char *pgconn_destring( struct pgconn_data *ptr, VALUE str, int *len);
|
|
25
22
|
static VALUE pgconn_encode_out4in( struct pgconn_data *ptr, VALUE str);
|
|
26
|
-
extern VALUE pgconn_mkstring( struct pgconn_data *ptr, const char *str);
|
|
27
|
-
extern VALUE pgconn_mkstringn( struct pgconn_data *ptr, const char *str, int len);
|
|
28
23
|
static VALUE pgconn_alloc( VALUE cls);
|
|
29
24
|
static VALUE pgconn_s_connect( int argc, VALUE *argv, VALUE cls);
|
|
30
25
|
static VALUE pgconn_init( int argc, VALUE *argv, VALUE self);
|
data/lib/conn_exec.c
CHANGED
|
@@ -36,11 +36,9 @@ static VALUE pgconn_get_notify( VALUE self);
|
|
|
36
36
|
|
|
37
37
|
static VALUE pgconn_transaction( int argc, VALUE *argv, VALUE self);
|
|
38
38
|
static VALUE rollback_transaction( VALUE conn, VALUE err);
|
|
39
|
-
static VALUE commit_transaction( VALUE self);
|
|
40
39
|
static VALUE yield_transaction( VALUE conn);
|
|
41
40
|
static VALUE pgconn_subtransaction( int argc, VALUE *argv, VALUE self);
|
|
42
41
|
static VALUE rollback_subtransaction( VALUE ary, VALUE err);
|
|
43
|
-
static VALUE release_subtransaction( VALUE ary);
|
|
44
42
|
static VALUE yield_subtransaction( VALUE ary);
|
|
45
43
|
static VALUE pgconn_transaction_status( VALUE self);
|
|
46
44
|
|
|
@@ -562,13 +560,17 @@ pgconn_transaction( int argc, VALUE *argv, VALUE conn)
|
|
|
562
560
|
rb_raise( rb_ePgConnTrans,
|
|
563
561
|
"Nested transaction block. Use Conn#subtransaction.");
|
|
564
562
|
pgresult_clear( pg_statement_exec( conn, cmd, Qnil));
|
|
565
|
-
return
|
|
563
|
+
return rb_rescue2( yield_transaction, conn, rollback_transaction, conn, rb_eException, (VALUE) 0);
|
|
566
564
|
}
|
|
567
565
|
|
|
568
566
|
VALUE
|
|
569
567
|
yield_transaction( VALUE conn)
|
|
570
568
|
{
|
|
571
|
-
|
|
569
|
+
VALUE r;
|
|
570
|
+
|
|
571
|
+
r = rb_yield( conn);
|
|
572
|
+
pgresult_clear( pg_statement_exec( conn, rb_str_new2( "COMMIT;"), Qnil));
|
|
573
|
+
return r;
|
|
572
574
|
}
|
|
573
575
|
|
|
574
576
|
VALUE
|
|
@@ -579,17 +581,6 @@ rollback_transaction( VALUE conn, VALUE err)
|
|
|
579
581
|
return Qnil;
|
|
580
582
|
}
|
|
581
583
|
|
|
582
|
-
VALUE
|
|
583
|
-
commit_transaction( VALUE conn)
|
|
584
|
-
{
|
|
585
|
-
struct pgconn_data *c;
|
|
586
|
-
|
|
587
|
-
c = get_pgconn( conn);
|
|
588
|
-
if (PQtransactionStatus( c->conn) > PQTRANS_IDLE)
|
|
589
|
-
pgresult_clear( pg_statement_exec( conn, rb_str_new2( "COMMIT;"), Qnil));
|
|
590
|
-
return Qnil;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
584
|
|
|
594
585
|
/*
|
|
595
586
|
* call-seq:
|
|
@@ -623,13 +614,23 @@ pgconn_subtransaction( int argc, VALUE *argv, VALUE self)
|
|
|
623
614
|
rb_str_buf_cat2( cmd, ";");
|
|
624
615
|
|
|
625
616
|
pgresult_clear( pg_statement_exec( self, cmd, Qnil));
|
|
626
|
-
return
|
|
617
|
+
return rb_rescue2( yield_subtransaction, ya, rollback_subtransaction, ya, rb_eException, (VALUE) 0);
|
|
627
618
|
}
|
|
628
619
|
|
|
629
620
|
VALUE
|
|
630
621
|
yield_subtransaction( VALUE ary)
|
|
631
622
|
{
|
|
632
|
-
|
|
623
|
+
VALUE conn;
|
|
624
|
+
VALUE r;
|
|
625
|
+
VALUE cmd;
|
|
626
|
+
|
|
627
|
+
conn = rb_ary_entry( ary, 0);
|
|
628
|
+
r = rb_yield( conn);
|
|
629
|
+
cmd = rb_str_buf_new2( "RELEASE SAVEPOINT ");
|
|
630
|
+
rb_str_buf_append( cmd, rb_ary_entry( ary, 1));
|
|
631
|
+
rb_str_buf_cat2( cmd, ";");
|
|
632
|
+
pgresult_clear( pg_statement_exec( conn, cmd, Qnil));
|
|
633
|
+
return r;
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
VALUE
|
|
@@ -646,24 +647,6 @@ rollback_subtransaction( VALUE ary, VALUE err)
|
|
|
646
647
|
return Qnil;
|
|
647
648
|
}
|
|
648
649
|
|
|
649
|
-
VALUE
|
|
650
|
-
release_subtransaction( VALUE ary)
|
|
651
|
-
{
|
|
652
|
-
VALUE cmd;
|
|
653
|
-
VALUE n;
|
|
654
|
-
|
|
655
|
-
n = rb_ary_entry( ary, 1);
|
|
656
|
-
if (!NIL_P( n)) {
|
|
657
|
-
cmd = rb_str_buf_new2( "RELEASE SAVEPOINT ");
|
|
658
|
-
rb_str_buf_append( cmd, n);
|
|
659
|
-
rb_str_buf_cat2( cmd, ";");
|
|
660
|
-
pgresult_clear( pg_statement_exec( rb_ary_entry( ary, 0), cmd, Qnil));
|
|
661
|
-
}
|
|
662
|
-
return Qnil;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
650
|
|
|
668
651
|
/*
|
|
669
652
|
* call-seq:
|
data/lib/conn_quote.c
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
#include "conn_quote.h"
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
extern VALUE pg_monetary_class( void);
|
|
10
|
-
|
|
11
9
|
static VALUE pgconn_format( VALUE self, VALUE obj);
|
|
12
10
|
|
|
13
11
|
static VALUE pgconn_escape_bytea( VALUE self, VALUE str);
|
|
@@ -17,9 +15,8 @@ static VALUE pgconn_unescape_bytea( int argc, VALUE *argv, VALUE self);
|
|
|
17
15
|
static VALUE pgconn_unescape_bytea( VALUE self, VALUE obj);
|
|
18
16
|
#endif
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
extern VALUE pgconn_for_copy( VALUE self, VALUE str);
|
|
18
|
+
static VALUE pgconn_for_copy( VALUE self, VALUE str);
|
|
19
|
+
|
|
23
20
|
static int needs_dquote_string( VALUE str);
|
|
24
21
|
static VALUE dquote_string( VALUE str);
|
|
25
22
|
static VALUE stringize_array( VALUE self, VALUE result, VALUE ary);
|
data/lib/module.c
CHANGED
data/lib/result.c
CHANGED
|
@@ -25,9 +25,6 @@ static void pgresult_mark( void *ptr);
|
|
|
25
25
|
static void pgresult_free( void *ptr);
|
|
26
26
|
static size_t pgresult_memsize( const void *ptr);
|
|
27
27
|
static VALUE pgresult_alloc( VALUE cls);
|
|
28
|
-
extern VALUE pgresult_new( PGresult *result, VALUE conn, VALUE cmd, VALUE par);
|
|
29
|
-
|
|
30
|
-
extern VALUE pgresult_clear( VALUE self);
|
|
31
28
|
|
|
32
29
|
static VALUE pgresult_status( VALUE self);
|
|
33
30
|
|
|
@@ -37,10 +34,7 @@ static VALUE pgresult_num_fields( VALUE self);
|
|
|
37
34
|
static VALUE pgresult_fieldname( VALUE self, VALUE index);
|
|
38
35
|
static VALUE pgresult_fieldnum( VALUE self, VALUE name);
|
|
39
36
|
|
|
40
|
-
extern VALUE pgresult_each( VALUE self);
|
|
41
37
|
static VALUE pgresult_aref( int argc, VALUE *argv, VALUE self);
|
|
42
|
-
extern VALUE pg_fetchrow( struct pgresult_data *r, int num);
|
|
43
|
-
extern VALUE pg_fetchresult( struct pgresult_data *r, int row, int col);
|
|
44
38
|
static VALUE pgresult_num_tuples( VALUE self);
|
|
45
39
|
|
|
46
40
|
static VALUE pgresult_type( VALUE self, VALUE index);
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pgsql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: '1.10'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bertram Scharpf
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: autorake
|
|
@@ -39,19 +38,19 @@ dependencies:
|
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '13.0'
|
|
41
40
|
description: |
|
|
42
|
-
This is not the official PostgreSQL library that was originally written by
|
|
43
|
-
Decoux. As the project wasn't maintained a long time after Guy's
|
|
44
|
-
decided to
|
|
41
|
+
This is not the official PostgreSQL library that was originally written by
|
|
42
|
+
Guy Decoux. As the project wasn't maintained a long time after Guy's
|
|
43
|
+
decease, I decided to create my own project.
|
|
45
44
|
email: "<software@bertram-scharpf.de>"
|
|
46
45
|
executables: []
|
|
47
46
|
extensions:
|
|
48
47
|
- lib/mkrf_conf
|
|
49
48
|
extra_rdoc_files:
|
|
50
|
-
- README
|
|
51
49
|
- LICENSE
|
|
50
|
+
- README.md
|
|
52
51
|
files:
|
|
53
52
|
- LICENSE
|
|
54
|
-
- README
|
|
53
|
+
- README.md
|
|
55
54
|
- lib/Rakefile
|
|
56
55
|
- lib/conn.c
|
|
57
56
|
- lib/conn.h
|
|
@@ -65,11 +64,10 @@ files:
|
|
|
65
64
|
- lib/result.c
|
|
66
65
|
- lib/result.h
|
|
67
66
|
- lib/undef.h
|
|
68
|
-
homepage:
|
|
67
|
+
homepage: https://github.com/BertramScharpf/ruby-pgsql.git
|
|
69
68
|
licenses:
|
|
70
69
|
- BSD-2-Clause
|
|
71
70
|
metadata: {}
|
|
72
|
-
post_install_message:
|
|
73
71
|
rdoc_options:
|
|
74
72
|
- "--main"
|
|
75
73
|
- README
|
|
@@ -79,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
79
77
|
requirements:
|
|
80
78
|
- - ">="
|
|
81
79
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
80
|
+
version: 3.1.0
|
|
83
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
82
|
requirements:
|
|
85
83
|
- - ">="
|
|
@@ -87,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
87
85
|
version: '0'
|
|
88
86
|
requirements:
|
|
89
87
|
- PostgreSQL
|
|
90
|
-
rubygems_version: 3.
|
|
91
|
-
signing_key:
|
|
88
|
+
rubygems_version: 3.7.1
|
|
92
89
|
specification_version: 4
|
|
93
90
|
summary: PostgreSQL-API for Ruby
|
|
94
91
|
test_files: []
|
data/README
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
= pgsql Ruby Gem
|
|
2
|
-
|
|
3
|
-
A PostgreSQL library that was carefully designed.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
== Author
|
|
7
|
-
|
|
8
|
-
Bertram Scharpf <software@bertram-scharpf.de>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
== Features
|
|
12
|
-
|
|
13
|
-
* Connection parameters from hash
|
|
14
|
-
* Query parameters
|
|
15
|
-
* Asynchronous queries
|
|
16
|
-
* Quick query of single lines or values
|
|
17
|
-
* Full PostgreSQL quoting support
|
|
18
|
-
* Built-in transactions and savepoints by Ruby blocks
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
== Example
|
|
22
|
-
|
|
23
|
-
Write something like this:
|
|
24
|
-
|
|
25
|
-
require "pgsql"
|
|
26
|
-
|
|
27
|
-
Pg::Conn.open :dbname => "test1", :user => "jdoe" do |conn|
|
|
28
|
-
conn.exec "SELECT * FROM mytable;" do |result|
|
|
29
|
-
result.each { |row|
|
|
30
|
-
l = row.join ", "
|
|
31
|
-
...
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
cmd = <<-ENDSQL
|
|
35
|
-
SELECT * FROM mytable WHERE num=$1::INTEGER;
|
|
36
|
-
ENDSQL
|
|
37
|
-
conn.query cmd, 42 do |row|
|
|
38
|
-
l = row.join ", "
|
|
39
|
-
...
|
|
40
|
-
end
|
|
41
|
-
...
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
== Thanks
|
|
46
|
-
|
|
47
|
-
In the remembrance of Guy Decoux.
|
|
48
|
-
|