pg 0.18.0 → 1.1.4
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/BSDL +2 -2
- data/ChangeLog +1221 -4
- data/History.rdoc +200 -0
- data/Manifest.txt +5 -18
- data/README-Windows.rdoc +15 -26
- data/README.rdoc +27 -10
- data/Rakefile +33 -24
- data/Rakefile.cross +57 -39
- data/ext/errorcodes.def +37 -0
- data/ext/errorcodes.rb +1 -1
- data/ext/errorcodes.txt +16 -1
- data/ext/extconf.rb +29 -35
- data/ext/gvl_wrappers.c +4 -0
- data/ext/gvl_wrappers.h +27 -39
- data/ext/pg.c +27 -53
- data/ext/pg.h +66 -83
- data/ext/pg_binary_decoder.c +75 -6
- data/ext/pg_binary_encoder.c +14 -12
- data/ext/pg_coder.c +83 -13
- data/ext/pg_connection.c +627 -351
- data/ext/pg_copy_coder.c +44 -9
- data/ext/pg_result.c +364 -134
- data/ext/pg_text_decoder.c +605 -46
- data/ext/pg_text_encoder.c +95 -76
- data/ext/pg_tuple.c +541 -0
- data/ext/pg_type_map.c +20 -13
- data/ext/pg_type_map_by_column.c +7 -7
- data/ext/pg_type_map_by_mri_type.c +2 -2
- data/ext/pg_type_map_in_ruby.c +4 -7
- data/ext/util.c +7 -7
- data/ext/util.h +3 -3
- data/lib/pg/basic_type_mapping.rb +105 -45
- data/lib/pg/binary_decoder.rb +22 -0
- data/lib/pg/coder.rb +1 -1
- data/lib/pg/connection.rb +109 -39
- data/lib/pg/constants.rb +1 -1
- data/lib/pg/exceptions.rb +1 -1
- data/lib/pg/result.rb +11 -6
- data/lib/pg/text_decoder.rb +25 -20
- data/lib/pg/text_encoder.rb +43 -1
- data/lib/pg/tuple.rb +30 -0
- data/lib/pg/type_map_by_column.rb +1 -1
- data/lib/pg.rb +21 -11
- data/spec/helpers.rb +50 -25
- data/spec/pg/basic_type_mapping_spec.rb +287 -30
- data/spec/pg/connection_spec.rb +695 -282
- data/spec/pg/connection_sync_spec.rb +41 -0
- data/spec/pg/result_spec.rb +59 -17
- data/spec/pg/tuple_spec.rb +280 -0
- data/spec/pg/type_map_by_class_spec.rb +3 -3
- data/spec/pg/type_map_by_column_spec.rb +1 -1
- data/spec/pg/type_map_by_mri_type_spec.rb +2 -2
- data/spec/pg/type_map_by_oid_spec.rb +1 -1
- data/spec/pg/type_map_in_ruby_spec.rb +1 -1
- data/spec/pg/type_map_spec.rb +1 -1
- data/spec/pg/type_spec.rb +319 -35
- data/spec/pg_spec.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +68 -68
- metadata.gz.sig +0 -0
- data/sample/array_insert.rb +0 -20
- data/sample/async_api.rb +0 -106
- data/sample/async_copyto.rb +0 -39
- data/sample/async_mixed.rb +0 -56
- data/sample/check_conn.rb +0 -21
- data/sample/copyfrom.rb +0 -81
- data/sample/copyto.rb +0 -19
- data/sample/cursor.rb +0 -21
- data/sample/disk_usage_report.rb +0 -186
- data/sample/issue-119.rb +0 -94
- data/sample/losample.rb +0 -69
- data/sample/minimal-testcase.rb +0 -17
- data/sample/notify_wait.rb +0 -72
- data/sample/pg_statistics.rb +0 -294
- data/sample/replication_monitor.rb +0 -231
- data/sample/test_binary_values.rb +0 -33
- data/sample/wal_shipper.rb +0 -434
- data/sample/warehouse_partitions.rb +0 -320
data/History.rdoc
CHANGED
@@ -1,3 +1,202 @@
|
|
1
|
+
== v1.1.4 [2019-01-08] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
- Fix PG::BinaryDecoder::Timestamp on 32 bit systems. # 284
|
4
|
+
- Add new error-codes of PostgreSQL-11.
|
5
|
+
- Add ruby-2.6 support for Windows fat binary gems and remove ruby-2.0 and 2.1.
|
6
|
+
|
7
|
+
|
8
|
+
== v1.1.3 [2018-09-06] Michael Granger <ged@FaerieMUD.org>
|
9
|
+
|
10
|
+
- Revert opimization that was sometimes causing EBADF in rb_wait_for_single_fd().
|
11
|
+
|
12
|
+
|
13
|
+
== v1.1.2 [2018-08-28] Michael Granger <ged@FaerieMUD.org>
|
14
|
+
|
15
|
+
- Don't generate aliases for JOHAB encoding.
|
16
|
+
This avoids linking to deprecated/private function rb_enc(db)_alias().
|
17
|
+
|
18
|
+
|
19
|
+
== v1.1.1 [2018-08-27] Michael Granger <ged@FaerieMUD.org>
|
20
|
+
|
21
|
+
- Reduce deprecation warnings to only one message per deprecation.
|
22
|
+
|
23
|
+
|
24
|
+
== v1.1.0 [2018-08-24] Michael Granger <ged@FaerieMUD.org>
|
25
|
+
|
26
|
+
Deprecated (disable warnings per PG_SKIP_DEPRECATION_WARNING=1):
|
27
|
+
- Forwarding conn.exec to conn.exec_params is deprecated.
|
28
|
+
- Forwarding conn.exec_params to conn.exec is deprecated.
|
29
|
+
- Forwarding conn.async_exec to conn.async_exec_params.
|
30
|
+
- Forwarding conn.send_query to conn.send_query_params is deprecated.
|
31
|
+
- Forwarding conn.async_exec_params to conn.async_exec is deprecated.
|
32
|
+
|
33
|
+
PG::Connection enhancements:
|
34
|
+
- Provide PG::Connection#sync_* and PG::Connection#async_* query methods for explicit calling syncronous or asynchronous libpq API.
|
35
|
+
- Make PG::Connection#exec and siblings switchable between sync and async API per PG::Connection.async_api= and change the default to async flavors.
|
36
|
+
- Add async flavors of exec_params, prepare, exec_prepared, describe_prepared and describe_portal.
|
37
|
+
They are identical to their syncronous counterpart, but make use of PostgreSQL's async API.
|
38
|
+
- Replace `rb_thread_fd_select()` by faster `rb_wait_for_single_fd()` in `conn.block` and `conn.async_exec` .
|
39
|
+
- Add PG::Connection#discard_results .
|
40
|
+
- Raise an ArgumentError for strings containing zero bytes by #escape, #escape_literal, #escape_identifier, #quote_ident and PG::TextEncoder::Identifier. These methods previously truncated strings.
|
41
|
+
|
42
|
+
Result retrieval enhancements:
|
43
|
+
- Add PG::Result#tuple_values to retrieve all field values of a row as array.
|
44
|
+
- Add PG::Tuple, PG::Result#tuple and PG::Result#stream_each_tuple .
|
45
|
+
PG::Tuple offers a way to lazy cast result values.
|
46
|
+
- Estimate PG::Result size allocated by libpq and notify the garbage collector about it when running on Ruby-2.4 or newer.
|
47
|
+
- Make the estimated PG::Result size available to ObjectSpace.memsize_of(result) .
|
48
|
+
|
49
|
+
Type cast enhancements:
|
50
|
+
- Replace Ruby code by a faster C implementation of the SimpleDecoder's timestamp decode functions. github #20
|
51
|
+
- Interpret years with up to 7 digists and BC dates by timestamp decoder.
|
52
|
+
- Add text timestamp decoders for UTC vs. local timezone variations.
|
53
|
+
- Add text timestamp encoders for UTC timezone.
|
54
|
+
- Add decoders for binary timestamps: PG::BinaryDecoder::Timestamp and variations.
|
55
|
+
- Add PG::Coder#flags accessor to allow modifications of de- respectively encoder behaviour.
|
56
|
+
- Add a flag to raise TypeError for invalid input values to PG::TextDecoder::Array .
|
57
|
+
- Add a text decoder for inet/cidr written in C.
|
58
|
+
- Add a numeric decoder written in C.
|
59
|
+
- Ensure input text is zero terminated for text format in PG::Coder#decode .
|
60
|
+
|
61
|
+
Source code enhancements:
|
62
|
+
- Fix headers and permission bits of various repository files.
|
63
|
+
|
64
|
+
Bugfixes:
|
65
|
+
- Properly decode array with prepended dimensions. #272
|
66
|
+
For now dimension decorations are ignored, but a correct Array is returned.
|
67
|
+
- Array-Decoder: Avoid leaking memory when an Exception is raised while parsing. Fixes #279
|
68
|
+
|
69
|
+
|
70
|
+
== v1.0.0 [2018-01-10] Michael Granger <ged@FaerieMUD.org>
|
71
|
+
|
72
|
+
Deprecated:
|
73
|
+
- Deprecate Ruby older than 2.2.
|
74
|
+
- Deprecate Connection#socket in favor of #socket_io.
|
75
|
+
|
76
|
+
Removed:
|
77
|
+
- Remove compatibility code for Ruby < 2.0 and PostgreSQL < 9.2.
|
78
|
+
- Remove partial compatibility with Rubinius.
|
79
|
+
- Remove top-level constants PGconn, PGresult, and PGError.
|
80
|
+
|
81
|
+
Enhancements:
|
82
|
+
- Update error codes to PostgreSQL-10
|
83
|
+
- Update Windows binary gems to Ruby-2.5, PostgreSQL 10.1 and
|
84
|
+
OpenSSL 1.1.0g.
|
85
|
+
|
86
|
+
Bugfixes:
|
87
|
+
- Fix URI detection for connection strings. #265 (thanks to jjoos)
|
88
|
+
- MINGW: Workaround segfault due to GCC linker error in conjunction with MSVC.
|
89
|
+
This happens when linking to PostgreSQL-10.0-x64 from EnterpriseDB.
|
90
|
+
|
91
|
+
Documentation fixes:
|
92
|
+
- Add PostgreSQL version since when the given function is supported. #263
|
93
|
+
- Better documentation to `encoder` and `decoder` arguments of COPY related methods.
|
94
|
+
|
95
|
+
|
96
|
+
== v0.21.0 [2017-06-12] Michael Granger <ged@FaerieMUD.org>
|
97
|
+
|
98
|
+
Enhancements:
|
99
|
+
- Move add_dll_directory to the Runtime namespace for newest versions
|
100
|
+
of RubyInstaller.
|
101
|
+
- Deprecate PGconn, PGresult, and PGError top-level constants; a warning
|
102
|
+
will be output the first time one of them is used. They will be
|
103
|
+
removed in the upcoming 1.0 release.
|
104
|
+
|
105
|
+
Documentation fixes:
|
106
|
+
- Update the docs for PG::Result#cmd_tuples
|
107
|
+
|
108
|
+
New Samples:
|
109
|
+
- Add an example of the nicer #copy_data way of doing `COPY`.
|
110
|
+
|
111
|
+
|
112
|
+
== v0.20.0 [2017-03-10] Michael Granger <ged@FaerieMUD.org>
|
113
|
+
|
114
|
+
Enhancements:
|
115
|
+
- Update error codes to PostgreSQL-9.6
|
116
|
+
- Update Windows binary gems to Ruby-2.4, PostgreSQL 9.6.1 and
|
117
|
+
OpenSSL 1.0.2j.
|
118
|
+
- Add support for RubyInstaller2 to Windows binary gems.
|
119
|
+
|
120
|
+
Bugfixes:
|
121
|
+
- Use secure JSON methods for JSON (de)serialisation. #248
|
122
|
+
- Fix Result#inspect on a cleared result.
|
123
|
+
- Fix test case that failed on Ruby-2.4. #255
|
124
|
+
|
125
|
+
Documentation fixes:
|
126
|
+
- Talk about Integer instead of Fixnum.
|
127
|
+
- Fix method signature of Coder#encode.
|
128
|
+
|
129
|
+
|
130
|
+
== v0.19.0 [2016-09-21] Michael Granger <ged@FaerieMUD.org>
|
131
|
+
|
132
|
+
- Deprecate Ruby 1.9
|
133
|
+
|
134
|
+
Enhancements:
|
135
|
+
- Respect and convert character encoding of all strings sent
|
136
|
+
to the server. #231
|
137
|
+
- Add PostgreSQL-9.5 functions PQsslInUse(), PQsslAttribute()
|
138
|
+
and PQsslAttributeNames().
|
139
|
+
- Various documentation fixes and improvements.
|
140
|
+
- Add mechanism to build without pg_config:
|
141
|
+
gem install pg -- --with-pg-config=ignore
|
142
|
+
- Update Windows binary gems to Ruby-2.3, PostgreSQL 9.5.4 and
|
143
|
+
OpenSSL 1.0.2f.
|
144
|
+
- Add JSON coders and add them to BasicTypeMapForResults and
|
145
|
+
BasicTypeMapBasedOnResult
|
146
|
+
- Allow build from git per bundler.
|
147
|
+
|
148
|
+
Bugfixes:
|
149
|
+
- Release GVL while calling PQsetClientEncoding(). #245
|
150
|
+
- Add __EXTENSIONS__ to Solaris/SmartOS for Ruby >= 2.3.x. #236
|
151
|
+
- Fix wrong exception when running SQL while in Connection#copy_data
|
152
|
+
block for output
|
153
|
+
|
154
|
+
|
155
|
+
== v0.18.4 [2015-11-13] Michael Granger <ged@FaerieMUD.org>
|
156
|
+
|
157
|
+
Enhancements:
|
158
|
+
- Fixing compilation problems with Microsoft Visual Studio 2008. GH #10
|
159
|
+
- Avoid name clash with xcode and jemalloc. PR#22, PR#23
|
160
|
+
|
161
|
+
Bugfixes:
|
162
|
+
- Avoid segfault, when quote_ident or TextEncoder::Identifier
|
163
|
+
is called with Array containing non-strings. #226
|
164
|
+
|
165
|
+
|
166
|
+
== v0.18.3 [2015-09-03] Michael Granger <ged@FaerieMUD.org>
|
167
|
+
|
168
|
+
Enhancements:
|
169
|
+
- Use rake-compiler-dock to build windows gems easily.
|
170
|
+
- Add CI-tests on appveyor and fix test cases accordingly.
|
171
|
+
|
172
|
+
Bugfixes:
|
173
|
+
- Fix data type resulting in wrong base64 encoding.
|
174
|
+
- Change instance_of checks to kind_of for subclassing. #220
|
175
|
+
- TextDecoder::Date returns an actual Ruby Date instead of a Time
|
176
|
+
(thanks to Thomas Ramfjord)
|
177
|
+
|
178
|
+
|
179
|
+
== v0.18.2 [2015-05-14] Michael Granger <ged@FaerieMUD.org>
|
180
|
+
|
181
|
+
Enhancements:
|
182
|
+
|
183
|
+
- Allow URI connection string (thanks to Chris Bandy)
|
184
|
+
- Allow Array type parameter to conn.quote_ident
|
185
|
+
|
186
|
+
Bugfixes:
|
187
|
+
|
188
|
+
- Speedups and fixes for PG::TextDecoder::Identifier and quoting behavior
|
189
|
+
- Revert addition of PG::Connection#hostaddr [#202].
|
190
|
+
- Fix decoding of fractional timezones and timestamps [#203]
|
191
|
+
- Fixes for non-C99 compilers
|
192
|
+
- Avoid possible symbol name clash when linking againt static libpq.
|
193
|
+
|
194
|
+
|
195
|
+
== v0.18.1 [2015-01-05] Michael Granger <ged@FaerieMUD.org>
|
196
|
+
|
197
|
+
Correct the minimum compatible Ruby version to 1.9.3. #199
|
198
|
+
|
199
|
+
|
1
200
|
== v0.18.0 [2015-01-01] Michael Granger <ged@FaerieMUD.org>
|
2
201
|
|
3
202
|
Bugfixes:
|
@@ -14,6 +213,7 @@ Enhancements:
|
|
14
213
|
- Add Enumerator variant to PG::Result#each and #each_row.
|
15
214
|
- Add PG::Connection#conninfo and #hostaddr.
|
16
215
|
- Add PG.init_openssl and PG.init_ssl methods.
|
216
|
+
- Add PG::Result.inspect
|
17
217
|
- Force zero termination for all text strings that are given to libpq.
|
18
218
|
It raises an ArgumentError if the string contains a null byte.
|
19
219
|
- Update Windows cross build to PostgreSQL 9.3.
|
data/Manifest.txt
CHANGED
@@ -29,6 +29,7 @@ ext/pg_errors.c
|
|
29
29
|
ext/pg_result.c
|
30
30
|
ext/pg_text_decoder.c
|
31
31
|
ext/pg_text_encoder.c
|
32
|
+
ext/pg_tuple.c
|
32
33
|
ext/pg_type_map.c
|
33
34
|
ext/pg_type_map_all_strings.c
|
34
35
|
ext/pg_type_map_by_class.c
|
@@ -43,6 +44,7 @@ ext/vc/pg_18/pg.vcproj
|
|
43
44
|
ext/vc/pg_19/pg_19.vcproj
|
44
45
|
lib/pg.rb
|
45
46
|
lib/pg/basic_type_mapping.rb
|
47
|
+
lib/pg/binary_decoder.rb
|
46
48
|
lib/pg/coder.rb
|
47
49
|
lib/pg/connection.rb
|
48
50
|
lib/pg/constants.rb
|
@@ -50,31 +52,16 @@ lib/pg/exceptions.rb
|
|
50
52
|
lib/pg/result.rb
|
51
53
|
lib/pg/text_decoder.rb
|
52
54
|
lib/pg/text_encoder.rb
|
55
|
+
lib/pg/tuple.rb
|
53
56
|
lib/pg/type_map_by_column.rb
|
54
|
-
sample/array_insert.rb
|
55
|
-
sample/async_api.rb
|
56
|
-
sample/async_copyto.rb
|
57
|
-
sample/async_mixed.rb
|
58
|
-
sample/check_conn.rb
|
59
|
-
sample/copyfrom.rb
|
60
|
-
sample/copyto.rb
|
61
|
-
sample/cursor.rb
|
62
|
-
sample/disk_usage_report.rb
|
63
|
-
sample/issue-119.rb
|
64
|
-
sample/losample.rb
|
65
|
-
sample/minimal-testcase.rb
|
66
|
-
sample/notify_wait.rb
|
67
|
-
sample/pg_statistics.rb
|
68
|
-
sample/replication_monitor.rb
|
69
|
-
sample/test_binary_values.rb
|
70
|
-
sample/wal_shipper.rb
|
71
|
-
sample/warehouse_partitions.rb
|
72
57
|
spec/data/expected_trace.out
|
73
58
|
spec/data/random_binary_data
|
74
59
|
spec/helpers.rb
|
75
60
|
spec/pg/basic_type_mapping_spec.rb
|
76
61
|
spec/pg/connection_spec.rb
|
62
|
+
spec/pg/connection_sync_spec.rb
|
77
63
|
spec/pg/result_spec.rb
|
64
|
+
spec/pg/tuple_spec.rb
|
78
65
|
spec/pg/type_map_by_class_spec.rb
|
79
66
|
spec/pg/type_map_by_column_spec.rb
|
80
67
|
spec/pg/type_map_by_mri_type_spec.rb
|
data/README-Windows.rdoc
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
In order to build this extension on MS Windows you will need a couple things.
|
4
4
|
|
5
|
-
First, a compiler. For the one click installer this means you should
|
6
|
-
|
7
|
-
|
5
|
+
First, a compiler. For the one click installer this means you should use
|
6
|
+
the DevKit or the compiler that comes with cygwin if you're building on that
|
7
|
+
platform.
|
8
8
|
|
9
9
|
If you've built Ruby yourself, you should use the same compiler to build
|
10
10
|
this library that you used to build Ruby.
|
@@ -29,34 +29,23 @@ Adjust your path accordingly. BE SURE TO USE THE SHORT PATH NAMES! If you
|
|
29
29
|
try to use a path with spaces in it, the nmake.exe program will choke.
|
30
30
|
|
31
31
|
|
32
|
-
==
|
32
|
+
== Building binary 'pg' gems for MS Windows
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
sources. There are no runtime dependencies to any but the standard Windows
|
38
|
-
DLLs.
|
34
|
+
Binary gems for windows can be built on Linux, OS-X and even on Windows
|
35
|
+
with the help of docker. This is how regular windows gems are built for
|
36
|
+
rubygems.org .
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
To do this, install boot2docker [on Windows](https://github.com/boot2docker/windows-installer/releases)
|
39
|
+
or [on OS X](https://github.com/boot2docker/osx-installer/releases) and make
|
40
|
+
sure it is started. A native Docker installation is best on Linux.
|
43
41
|
|
44
|
-
|
42
|
+
Then run:
|
45
43
|
|
46
|
-
rake
|
47
|
-
rake-compiler cross-ruby VERSION=1.9.2-p290
|
44
|
+
rake gem:windows
|
48
45
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
or with custom versions:
|
54
|
-
|
55
|
-
rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2 \
|
56
|
-
OPENSSL_VERSION=1.0.0e POSTGRESQL_VERSION=9.1.1
|
57
|
-
|
58
|
-
If everything works, there should be pg-VERSION-x86-mingw32.gem in the pkg
|
59
|
-
directory.
|
46
|
+
This will download a docker image suited for building windows gems, and it
|
47
|
+
will download and build OpenSSL and PostgreSQL. Finally the gem is built
|
48
|
+
containing binaries for all supported ruby versions.
|
60
49
|
|
61
50
|
|
62
51
|
== Reporting Problems
|
data/README.rdoc
CHANGED
@@ -4,12 +4,14 @@ home :: https://bitbucket.org/ged/ruby-pg
|
|
4
4
|
mirror :: https://github.com/ged/ruby-pg
|
5
5
|
docs :: http://deveiate.org/code/pg
|
6
6
|
|
7
|
+
{<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/ged/ruby-pg">}[https://gitter.im/ged/ruby-pg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
|
8
|
+
|
7
9
|
|
8
10
|
== Description
|
9
11
|
|
10
12
|
Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
|
11
13
|
|
12
|
-
It works with {PostgreSQL
|
14
|
+
It works with {PostgreSQL 9.2 and later}[http://www.postgresql.org/support/versioning/].
|
13
15
|
|
14
16
|
A small example usage:
|
15
17
|
|
@@ -21,7 +23,7 @@ A small example usage:
|
|
21
23
|
conn = PG.connect( dbname: 'sales' )
|
22
24
|
conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
|
23
25
|
puts " PID | User | Query"
|
24
|
-
|
26
|
+
result.each do |row|
|
25
27
|
puts " %7d | %-16s | %s " %
|
26
28
|
row.values_at('procpid', 'usename', 'current_query')
|
27
29
|
end
|
@@ -29,18 +31,30 @@ A small example usage:
|
|
29
31
|
|
30
32
|
== Build Status
|
31
33
|
|
32
|
-
{<img src="https://travis-ci.org/ged/ruby-pg.
|
34
|
+
{<img src="https://travis-ci.org/ged/ruby-pg.svg?branch=master" alt="Build Status Travis-CI" />}[https://travis-ci.org/ged/ruby-pg]
|
35
|
+
{<img src="https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg]
|
33
36
|
|
34
37
|
|
35
38
|
== Requirements
|
36
39
|
|
37
|
-
* Ruby
|
38
|
-
* PostgreSQL
|
40
|
+
* Ruby 2.2 or newer
|
41
|
+
* PostgreSQL 9.2.x or later (with headers, -dev packages, etc).
|
39
42
|
|
40
|
-
It
|
43
|
+
It usually work with earlier versions of Ruby/PostgreSQL as well, but those are
|
41
44
|
not regularly tested.
|
42
45
|
|
43
46
|
|
47
|
+
== Versioning
|
48
|
+
|
49
|
+
We tag and release gems according to the {Semantic Versioning}[http://semver.org/] principle.
|
50
|
+
|
51
|
+
As a result of this policy, you can (and should) specify a dependency on this gem using the {Pessimistic Version Constraint}[http://guides.rubygems.org/patterns/#pessimistic-version-constraint] with two digits of precision.
|
52
|
+
|
53
|
+
For example:
|
54
|
+
|
55
|
+
spec.add_dependency 'pg', '~> 1.0'
|
56
|
+
|
57
|
+
|
44
58
|
== How To Install
|
45
59
|
|
46
60
|
Install via RubyGems:
|
@@ -63,6 +77,10 @@ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
|
|
63
77
|
{mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
|
64
78
|
want to chat about something.
|
65
79
|
|
80
|
+
If you want to install as a signed gem, the public certs of the gem signers
|
81
|
+
can be found in {the `certs` directory}[https://bitbucket.org/ged/ruby-pg/src/tip/certs/]
|
82
|
+
of the repository.
|
83
|
+
|
66
84
|
|
67
85
|
== Type Casts
|
68
86
|
|
@@ -109,7 +127,7 @@ needs for type casting. The default type map is PG::TypeMapAllStrings.
|
|
109
127
|
|
110
128
|
A type map can be assigned per connection or per query respectively per
|
111
129
|
result set. Type maps can also be used for COPY in and out data streaming.
|
112
|
-
|
130
|
+
See PG::Connection#copy_data .
|
113
131
|
|
114
132
|
== Contributing
|
115
133
|
|
@@ -130,7 +148,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
|
|
130
148
|
|
131
149
|
== Copying
|
132
150
|
|
133
|
-
Copyright (c) 1997-
|
151
|
+
Copyright (c) 1997-2016 by the authors.
|
134
152
|
|
135
153
|
* Jeff Davis <ruby-pg@j-davis.com>
|
136
154
|
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
@@ -142,7 +160,7 @@ Copyright (c) 1997-2013 by the authors.
|
|
142
160
|
* Noboru Saitou <noborus@netlab.jp>
|
143
161
|
|
144
162
|
You may redistribute this software under the same terms as Ruby itself; see
|
145
|
-
|
163
|
+
https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
|
146
164
|
for details.
|
147
165
|
|
148
166
|
Portions of the code are from the PostgreSQL project, and are distributed
|
@@ -158,4 +176,3 @@ to this library over the years.
|
|
158
176
|
|
159
177
|
We are thankful to the people at the ruby-list and ruby-dev mailing lists.
|
160
178
|
And to the people who developed PostgreSQL.
|
161
|
-
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# -*- rake -*-
|
2
2
|
|
3
3
|
require 'rbconfig'
|
4
4
|
require 'pathname'
|
@@ -55,29 +55,24 @@ $hoespec = Hoe.spec 'pg' do
|
|
55
55
|
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
|
56
56
|
self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
|
57
57
|
self.extra_rdoc_files.include( 'ext/*.c' )
|
58
|
-
self.license
|
58
|
+
self.license 'BSD-3-Clause'
|
59
59
|
|
60
60
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
61
61
|
self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
|
62
62
|
|
63
|
-
self.dependency 'rake-compiler', '~> 0
|
64
|
-
self.dependency '
|
65
|
-
self.dependency 'hoe-deveiate', '~> 0.
|
63
|
+
self.dependency 'rake-compiler', '~> 1.0', :developer
|
64
|
+
self.dependency 'rake-compiler-dock', ['~> 0.7.0'], :developer
|
65
|
+
self.dependency 'hoe-deveiate', '~> 0.9', :developer
|
66
66
|
self.dependency 'hoe-bundler', '~> 1.0', :developer
|
67
|
-
self.dependency 'rspec', '~> 3.
|
67
|
+
self.dependency 'rspec', '~> 3.5', :developer
|
68
|
+
self.dependency 'rdoc', '~> 5.1', :developer
|
68
69
|
|
69
|
-
self.spec_extras[:licenses] = ['BSD', 'Ruby', 'GPL']
|
70
70
|
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
|
71
71
|
|
72
|
-
self.require_ruby_version( '>=
|
72
|
+
self.require_ruby_version( '>= 2.0.0' )
|
73
73
|
|
74
74
|
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
75
75
|
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
76
|
-
self.spec_extras[:rdoc_options] = [
|
77
|
-
'-f', 'fivefish',
|
78
|
-
'-t', 'pg: The Ruby Interface to PostgreSQL',
|
79
|
-
'-m', 'README.rdoc',
|
80
|
-
]
|
81
76
|
|
82
77
|
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
83
78
|
end
|
@@ -85,7 +80,7 @@ end
|
|
85
80
|
ENV['VERSION'] ||= $hoespec.spec.version.to_s
|
86
81
|
|
87
82
|
# Tests should pass before checking in
|
88
|
-
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
83
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec, :gemspec ]
|
89
84
|
|
90
85
|
# Support for 'rvm specs'
|
91
86
|
task :specs => :spec
|
@@ -101,7 +96,7 @@ task :test do
|
|
101
96
|
# the installed gem dir. So we clear the task rake-compiler set up
|
102
97
|
# to break the dependency between :spec and :compile when running under
|
103
98
|
# rubygems-test, and then run :spec.
|
104
|
-
Rake::Task[ EXT.to_s ].clear
|
99
|
+
Rake::Task[ EXT.to_s ].clear if File.exist?(EXT.to_s)
|
105
100
|
Rake::Task[ :spec ].execute
|
106
101
|
end
|
107
102
|
|
@@ -110,8 +105,6 @@ task :maint do
|
|
110
105
|
ENV['MAINTAINER_MODE'] = 'yes'
|
111
106
|
end
|
112
107
|
|
113
|
-
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2:2.0.0'
|
114
|
-
|
115
108
|
# Rake-compiler task
|
116
109
|
Rake::ExtensionTask.new do |ext|
|
117
110
|
ext.name = 'pg_ext'
|
@@ -136,8 +129,22 @@ Rake::ExtensionTask.new do |ext|
|
|
136
129
|
|
137
130
|
# Add libpq.dll to windows binary gemspec
|
138
131
|
ext.cross_compiling do |spec|
|
139
|
-
|
140
|
-
|
132
|
+
spec.files << "lib/libpq.dll"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
# Use the fivefish formatter for docs generated from development checkout
|
138
|
+
if File.directory?( '.hg' )
|
139
|
+
require 'rdoc/task'
|
140
|
+
|
141
|
+
Rake::Task[ 'docs' ].clear
|
142
|
+
RDoc::Task.new( 'docs' ) do |rdoc|
|
143
|
+
rdoc.main = "README.rdoc"
|
144
|
+
rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb", 'ext/**/*.{c,h}' )
|
145
|
+
rdoc.generator = :fivefish
|
146
|
+
rdoc.title = "PG: The Ruby PostgreSQL Driver"
|
147
|
+
rdoc.rdoc_dir = 'doc'
|
141
148
|
end
|
142
149
|
end
|
143
150
|
|
@@ -146,10 +153,12 @@ end
|
|
146
153
|
file '.hg/branch' do
|
147
154
|
warn "WARNING: You need the Mercurial repo to update the ChangeLog"
|
148
155
|
end
|
156
|
+
Rake::Task["ChangeLog"].clear
|
149
157
|
file 'ChangeLog' do |task|
|
150
158
|
if File.exist?('.hg/branch')
|
151
159
|
$stderr.puts "Updating the changelog..."
|
152
160
|
begin
|
161
|
+
include Hoe::MercurialHelpers
|
153
162
|
content = make_changelog()
|
154
163
|
rescue NameError
|
155
164
|
abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
|
@@ -175,13 +184,11 @@ end
|
|
175
184
|
|
176
185
|
desc "Update list of server error codes"
|
177
186
|
task :update_error_codes do
|
178
|
-
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=
|
187
|
+
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_11_1"
|
179
188
|
|
180
189
|
ERRORCODES_TXT = "ext/errorcodes.txt"
|
181
190
|
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
182
|
-
end
|
183
191
|
|
184
|
-
file 'ext/errorcodes.def' => ['ext/errorcodes.rb', 'ext/errorcodes.txt'] do
|
185
192
|
ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', 'ext/errorcodes.def'
|
186
193
|
end
|
187
194
|
|
@@ -195,12 +202,14 @@ file GEMSPEC => __FILE__
|
|
195
202
|
task GEMSPEC do |task|
|
196
203
|
spec = $hoespec.spec
|
197
204
|
spec.files.delete( '.gemtest' )
|
198
|
-
spec.
|
205
|
+
spec.signing_key = nil
|
206
|
+
spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
207
|
+
spec.cert_chain = [ 'certs/ged.pem' ]
|
199
208
|
File.open( task.name, 'w' ) do |fh|
|
200
209
|
fh.write( spec.to_ruby )
|
201
210
|
end
|
202
211
|
end
|
203
212
|
|
204
|
-
CLOBBER.include(
|
213
|
+
CLOBBER.include( '*.gemspec' )
|
205
214
|
task :default => :gemspec
|
206
215
|
|