pg 1.1.4 → 1.2.2
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/ChangeLog +0 -6595
- data/History.rdoc +77 -0
- data/Manifest.txt +3 -2
- data/README-Windows.rdoc +4 -4
- data/README.ja.rdoc +1 -2
- data/README.rdoc +43 -8
- data/Rakefile +7 -5
- data/Rakefile.cross +46 -44
- data/ext/errorcodes.def +64 -0
- data/ext/errorcodes.txt +18 -2
- data/ext/extconf.rb +6 -6
- data/ext/pg.c +132 -95
- data/ext/pg.h +20 -18
- data/ext/pg_binary_decoder.c +9 -9
- data/ext/pg_binary_encoder.c +13 -12
- data/ext/pg_coder.c +5 -5
- data/ext/pg_connection.c +388 -298
- data/ext/pg_copy_coder.c +5 -3
- data/ext/pg_record_coder.c +490 -0
- data/ext/pg_result.c +279 -127
- data/ext/pg_text_decoder.c +14 -8
- data/ext/pg_text_encoder.c +180 -48
- data/ext/pg_tuple.c +14 -6
- data/ext/pg_type_map.c +1 -1
- data/ext/pg_type_map_all_strings.c +4 -4
- data/ext/pg_type_map_by_class.c +4 -3
- data/ext/pg_type_map_by_column.c +7 -6
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +3 -2
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/ext/{util.c → pg_util.c} +5 -5
- data/ext/{util.h → pg_util.h} +0 -0
- data/lib/pg.rb +4 -4
- data/lib/pg/basic_type_mapping.rb +79 -16
- data/lib/pg/binary_decoder.rb +1 -0
- data/lib/pg/coder.rb +22 -1
- data/lib/pg/connection.rb +2 -2
- data/lib/pg/constants.rb +1 -0
- data/lib/pg/exceptions.rb +1 -0
- data/lib/pg/result.rb +13 -1
- data/lib/pg/text_decoder.rb +2 -3
- data/lib/pg/text_encoder.rb +8 -18
- data/lib/pg/type_map_by_column.rb +2 -1
- data/spec/helpers.rb +10 -8
- data/spec/pg/basic_type_mapping_spec.rb +150 -13
- data/spec/pg/connection_spec.rb +89 -50
- data/spec/pg/result_spec.rb +193 -3
- data/spec/pg/tuple_spec.rb +55 -2
- data/spec/pg/type_map_by_column_spec.rb +5 -1
- data/spec/pg/type_spec.rb +180 -6
- metadata +33 -32
- metadata.gz.sig +0 -0
data/History.rdoc
CHANGED
@@ -1,3 +1,80 @@
|
|
1
|
+
== v1.2.2 [2020-01-06] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
|
5
|
+
- Add a binary gem for Ruby 2.7.
|
6
|
+
|
7
|
+
|
8
|
+
== v1.2.1 [2020-01-02] Michael Granger <ged@FaerieMUD.org>
|
9
|
+
|
10
|
+
Enhancements:
|
11
|
+
|
12
|
+
- Added internal API for sequel_pg compatibility.
|
13
|
+
|
14
|
+
|
15
|
+
== v1.2.0 [2019-12-20] Michael Granger <ged@FaerieMUD.org>
|
16
|
+
|
17
|
+
Repository:
|
18
|
+
- Our primary repository has been moved to Github https://github.com/ged/ruby-pg .
|
19
|
+
Most of the issues from https://bitbucket.org/ged/ruby-pg have been migrated. #43
|
20
|
+
|
21
|
+
API enhancements:
|
22
|
+
- Add PG::Result#field_name_type= and siblings to allow symbols to be used as field names. #306
|
23
|
+
- Add new methods for error reporting:
|
24
|
+
- PG::Connection#set_error_context_visibility
|
25
|
+
- PG::Result#verbose_error_message
|
26
|
+
- PG::Result#result_verbose_error_message (alias)
|
27
|
+
- Update errorcodes and error classes to PostgreSQL-12.0.
|
28
|
+
- New constants: PG_DIAG_SEVERITY_NONLOCALIZED, PQERRORS_SQLSTATE, PQSHOW_CONTEXT_NEVER, PQSHOW_CONTEXT_ERRORS, PQSHOW_CONTEXT_ALWAYS
|
29
|
+
|
30
|
+
Type cast enhancements:
|
31
|
+
- Add PG::TextEncoder::Record and PG::TextDecoder::Record for en/decoding of Composite Types. #258, #36
|
32
|
+
- Add PG::BasicTypeRegistry.register_coder to register instances instead of classes.
|
33
|
+
This is useful to register parametrized en/decoders like PG::TextDecoder::Record .
|
34
|
+
- Add PG::BasicTypeMapForQueries#encode_array_as= to switch between various interpretations of ruby arrays.
|
35
|
+
- Add Time, Array<Time>, Array<BigDecimal> and Array<IPAddr> encoders to PG::BasicTypeMapForQueries
|
36
|
+
- Exchange sprintf based float encoder by very fast own implementation with more natural format. #301
|
37
|
+
- Define encode and decode methods only in en/decoders that implement it, so that they can be queried by respond_to? .
|
38
|
+
- Improve PG::TypeMapByColumn#inspect
|
39
|
+
- Accept Integer and Float as input to TextEncoder::Numeric . #310
|
40
|
+
|
41
|
+
Other enhancements:
|
42
|
+
- Allocate the data part and the ruby object of PG::Result in one step, so that we don't need to check for valid data.
|
43
|
+
This removes PG::Result.allocate and PG::Result.new, which were callable but without any practical use. #42
|
44
|
+
- Make use of PQresultMemorySize() of PostgreSQL-12 and fall back to our internal estimator.
|
45
|
+
- Improve performance of PG::Result#stream_each_tuple .
|
46
|
+
- Store client encoding in data part of PG::Connection and PG::Result objects, so that we no longer use ruby's internal encoding bits. #280
|
47
|
+
- Update Windows fat binary gem to OpenSSL-1.1.1d and PostgreSQL-12.1.
|
48
|
+
- Add support for TruffleRuby. It is regulary tested as part of our CI.
|
49
|
+
- Enable +frozen_string_literal+ in all pg's ruby files
|
50
|
+
|
51
|
+
Bugfixes:
|
52
|
+
- Update the license in gemspec to "BSD-2-Clause".
|
53
|
+
It was incorrectly labeled "BSD-3-Clause". #40
|
54
|
+
- Respect PG::Coder#flags in PG::Coder#to_h.
|
55
|
+
- Fix PG::Result memsize reporting after #clear.
|
56
|
+
- Release field names to GC on PG::Result#clear.
|
57
|
+
- Fix double free in PG::Result#stream_each_tuple when an exception is raised in the block.
|
58
|
+
- Fix PG::Result#stream_each_tuple to deliver typemapped values.
|
59
|
+
- Fix encoding of Array<unknown> with PG::BasicTypeMapForQueries
|
60
|
+
|
61
|
+
Deprecated:
|
62
|
+
- Add a deprecation warning to PG::Connection#socket .
|
63
|
+
|
64
|
+
Removed:
|
65
|
+
- Remove PG::Connection#guess_result_memsize= which was temporary added in pg-1.1.
|
66
|
+
- Remove PG::Result.allocate and PG::Result.new (see enhancements).
|
67
|
+
- Remove support of tainted objects. #307
|
68
|
+
- Remove support of ruby-2.0 and 2.1. Minimum is ruby-2.2 now.
|
69
|
+
|
70
|
+
Documentation:
|
71
|
+
- Update description of connection params. See PG::Connection.new
|
72
|
+
- Link many method descriptions to corresponding libpq's documentation.
|
73
|
+
- Update sync_* and async_* query method descriptions and document the aliases.
|
74
|
+
The primary documentation is now at the async_* methods which are the default since pg-1.1.
|
75
|
+
- Fix documentation of many constants
|
76
|
+
|
77
|
+
|
1
78
|
== v1.1.4 [2019-01-08] Michael Granger <ged@FaerieMUD.org>
|
2
79
|
|
3
80
|
- Fix PG::BinaryDecoder::Timestamp on 32 bit systems. # 284
|
data/Manifest.txt
CHANGED
@@ -26,6 +26,7 @@ ext/pg_coder.c
|
|
26
26
|
ext/pg_connection.c
|
27
27
|
ext/pg_copy_coder.c
|
28
28
|
ext/pg_errors.c
|
29
|
+
ext/pg_record_coder.c
|
29
30
|
ext/pg_result.c
|
30
31
|
ext/pg_text_decoder.c
|
31
32
|
ext/pg_text_encoder.c
|
@@ -37,8 +38,8 @@ ext/pg_type_map_by_column.c
|
|
37
38
|
ext/pg_type_map_by_mri_type.c
|
38
39
|
ext/pg_type_map_by_oid.c
|
39
40
|
ext/pg_type_map_in_ruby.c
|
40
|
-
ext/
|
41
|
-
ext/
|
41
|
+
ext/pg_util.c
|
42
|
+
ext/pg_util.h
|
42
43
|
ext/vc/pg.sln
|
43
44
|
ext/vc/pg_18/pg.vcproj
|
44
45
|
ext/vc/pg_19/pg_19.vcproj
|
data/README-Windows.rdoc
CHANGED
@@ -35,8 +35,8 @@ Binary gems for windows can be built on Linux, OS-X and even on Windows
|
|
35
35
|
with the help of docker. This is how regular windows gems are built for
|
36
36
|
rubygems.org .
|
37
37
|
|
38
|
-
To do this, install boot2docker
|
39
|
-
or
|
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
40
|
sure it is started. A native Docker installation is best on Linux.
|
41
41
|
|
42
42
|
Then run:
|
@@ -50,7 +50,7 @@ containing binaries for all supported ruby versions.
|
|
50
50
|
|
51
51
|
== Reporting Problems
|
52
52
|
|
53
|
-
If you have any problems you can submit them via
|
54
|
-
|
53
|
+
If you have any problems you can submit them via {the project's
|
54
|
+
issue-tracker}[https://github.com/ged/ruby-pg/issues]. And submit questions, problems, or
|
55
55
|
solutions, so that it can be improved.
|
56
56
|
|
data/README.ja.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
= pg
|
2
2
|
|
3
|
-
home :: https://
|
4
|
-
mirror :: https://github.com/ged/ruby-pg
|
3
|
+
home :: https://github.com/ged/ruby-pg
|
5
4
|
docs :: http://deveiate.org/code/pg
|
6
5
|
|
7
6
|
{<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]
|
@@ -32,7 +31,7 @@ A small example usage:
|
|
32
31
|
== Build Status
|
33
32
|
|
34
33
|
{<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/
|
34
|
+
{<img src="https://ci.appveyor.com/api/projects/status/gjx5axouf3b1wicp?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg-9j8l3]
|
36
35
|
|
37
36
|
|
38
37
|
== Requirements
|
@@ -78,7 +77,7 @@ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
|
|
78
77
|
want to chat about something.
|
79
78
|
|
80
79
|
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://
|
80
|
+
can be found in {the `certs` directory}[https://github.com/ged/ruby-pg/tree/master/certs]
|
82
81
|
of the repository.
|
83
82
|
|
84
83
|
|
@@ -118,6 +117,30 @@ to build composite types by assigning an element encoder/decoder.
|
|
118
117
|
PG::Coder objects can be used to set up a PG::TypeMap or alternatively
|
119
118
|
to convert single values to/from their string representation.
|
120
119
|
|
120
|
+
The following PostgreSQL column types are supported by ruby-pg (TE = Text Encoder, TD = Text Decoder, BE = Binary Encoder, BD = Binary Decoder):
|
121
|
+
* Integer: {TE}[rdoc-ref:PG::TextEncoder::Integer], {TD}[rdoc-ref:PG::TextDecoder::Integer], {BD}[rdoc-ref:PG::BinaryDecoder::Integer] 💡 No links? Switch to {here}[https://deveiate.org/code/pg/README_rdoc.html#label-Type+Casts] 💡
|
122
|
+
* BE: {Int2}[rdoc-ref:PG::BinaryEncoder::Int2], {Int4}[rdoc-ref:PG::BinaryEncoder::Int4], {Int8}[rdoc-ref:PG::BinaryEncoder::Int8]
|
123
|
+
* Float: {TE}[rdoc-ref:PG::TextEncoder::Float], {TD}[rdoc-ref:PG::TextDecoder::Float], {BD}[rdoc-ref:PG::BinaryDecoder::Float]
|
124
|
+
* Numeric: {TE}[rdoc-ref:PG::TextEncoder::Numeric], {TD}[rdoc-ref:PG::TextDecoder::Numeric]
|
125
|
+
* Boolean: {TE}[rdoc-ref:PG::TextEncoder::Boolean], {TD}[rdoc-ref:PG::TextDecoder::Boolean], {BE}[rdoc-ref:PG::BinaryEncoder::Boolean], {BD}[rdoc-ref:PG::BinaryDecoder::Boolean]
|
126
|
+
* String: {TE}[rdoc-ref:PG::TextEncoder::String], {TD}[rdoc-ref:PG::TextDecoder::String], {BE}[rdoc-ref:PG::BinaryEncoder::String], {BD}[rdoc-ref:PG::BinaryDecoder::String]
|
127
|
+
* Bytea: {TE}[rdoc-ref:PG::TextEncoder::Bytea], {TD}[rdoc-ref:PG::TextDecoder::Bytea], {BE}[rdoc-ref:PG::BinaryEncoder::Bytea], {BD}[rdoc-ref:PG::BinaryDecoder::Bytea]
|
128
|
+
* Base64: {TE}[rdoc-ref:PG::TextEncoder::ToBase64], {TD}[rdoc-ref:PG::TextDecoder::FromBase64], {BE}[rdoc-ref:PG::BinaryEncoder::FromBase64], {BD}[rdoc-ref:PG::BinaryDecoder::ToBase64]
|
129
|
+
* Timestamp:
|
130
|
+
* TE: {local}[rdoc-ref:PG::TextEncoder::TimestampWithoutTimeZone], {UTC}[rdoc-ref:PG::TextEncoder::TimestampUtc], {with-TZ}[rdoc-ref:PG::TextEncoder::TimestampWithTimeZone]
|
131
|
+
* TD: {local}[rdoc-ref:PG::TextDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::TextDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::TextDecoder::TimestampUtcToLocal]
|
132
|
+
* BD: {local}[rdoc-ref:PG::BinaryDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::BinaryDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::BinaryDecoder::TimestampUtcToLocal]
|
133
|
+
* Date: {TE}[rdoc-ref:PG::TextEncoder::Date], {TD}[rdoc-ref:PG::TextDecoder::Date]
|
134
|
+
* JSON and JSONB: {TE}[rdoc-ref:PG::TextEncoder::JSON], {TD}[rdoc-ref:PG::TextDecoder::JSON]
|
135
|
+
* Inet: {TE}[rdoc-ref:PG::TextEncoder::Inet], {TD}[rdoc-ref:PG::TextDecoder::Inet]
|
136
|
+
* Array: {TE}[rdoc-ref:PG::TextEncoder::Array], {TD}[rdoc-ref:PG::TextDecoder::Array]
|
137
|
+
* Composite Type (also called "Row" or "Record"): {TE}[rdoc-ref:PG::TextEncoder::Record], {TD}[rdoc-ref:PG::TextDecoder::Record]
|
138
|
+
|
139
|
+
The following text formats can also be encoded although they are not used as column type:
|
140
|
+
* COPY input and output data: {TE}[rdoc-ref:PG::TextEncoder::CopyRow], {TD}[rdoc-ref:PG::TextDecoder::CopyRow]
|
141
|
+
* Literal for insertion into SQL string: {TE}[rdoc-ref:PG::TextEncoder::QuotedLiteral]
|
142
|
+
* SQL-Identifier: {TE}[rdoc-ref:PG::TextEncoder::Identifier], {TD}[rdoc-ref:PG::TextDecoder::Identifier]
|
143
|
+
|
121
144
|
=== PG::TypeMap and derivations (ext/pg_type_map*.c, lib/pg/type_map*.rb)
|
122
145
|
|
123
146
|
A TypeMap defines which value will be converted by which encoder/decoder.
|
@@ -129,11 +152,23 @@ A type map can be assigned per connection or per query respectively per
|
|
129
152
|
result set. Type maps can also be used for COPY in and out data streaming.
|
130
153
|
See PG::Connection#copy_data .
|
131
154
|
|
155
|
+
The following base type maps are available:
|
156
|
+
* PG::TypeMapAllStrings - encodes and decodes all values to and from strings (default)
|
157
|
+
* PG::TypeMapByClass - selects encoder based on the class of the value to be sent
|
158
|
+
* PG::TypeMapByColumn - selects encoder and decoder by column order
|
159
|
+
* PG::TypeMapByOid - selects decoder by PostgreSQL type OID
|
160
|
+
* PG::TypeMapInRuby - define a custom type map in ruby
|
161
|
+
|
162
|
+
The following type maps are prefilled with type mappings from the PG::BasicTypeRegistry :
|
163
|
+
* PG::BasicTypeMapForResults - a PG::TypeMapByOid prefilled with decoders for common PostgreSQL column types
|
164
|
+
* PG::BasicTypeMapBasedOnResult - a PG::TypeMapByOid prefilled with encoders for common PostgreSQL column types
|
165
|
+
* PG::BasicTypeMapForQueries - a PG::TypeMapByClass prefilled with encoders for common Ruby value classes
|
166
|
+
|
167
|
+
|
132
168
|
== Contributing
|
133
169
|
|
134
|
-
To report bugs, suggest features, or check out the source with
|
135
|
-
{check out the project page}[
|
136
|
-
Git, there's also a {Github mirror}[https://github.com/ged/ruby-pg].
|
170
|
+
To report bugs, suggest features, or check out the source with Git,
|
171
|
+
{check out the project page}[https://github.com/ged/ruby-pg].
|
137
172
|
|
138
173
|
After checking out the source, run:
|
139
174
|
|
@@ -148,7 +183,7 @@ Lars Kanis
|
|
148
183
|
|
149
184
|
== Copying
|
150
185
|
|
151
|
-
Copyright (c) 1997-
|
186
|
+
Copyright (c) 1997-2019 by the authors.
|
152
187
|
|
153
188
|
* Jeff Davis <ruby-pg@j-davis.com>
|
154
189
|
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
data/Rakefile
CHANGED
@@ -35,6 +35,8 @@ TEST_DIRECTORY = BASEDIR + "tmp_test_specs"
|
|
35
35
|
|
36
36
|
CLOBBER.include( TEST_DIRECTORY.to_s )
|
37
37
|
CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
|
38
|
+
CLEAN.include "lib/*/libpq.dll"
|
39
|
+
CLEAN.include "lib/pg_ext.*"
|
38
40
|
|
39
41
|
# Set up Hoe plugins
|
40
42
|
Hoe.plugin :mercurial
|
@@ -55,13 +57,13 @@ $hoespec = Hoe.spec 'pg' do
|
|
55
57
|
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
|
56
58
|
self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
|
57
59
|
self.extra_rdoc_files.include( 'ext/*.c' )
|
58
|
-
self.license 'BSD-
|
60
|
+
self.license 'BSD-2-Clause'
|
59
61
|
|
60
62
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
61
63
|
self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
|
62
64
|
|
63
65
|
self.dependency 'rake-compiler', '~> 1.0', :developer
|
64
|
-
self.dependency 'rake-compiler-dock', ['~>
|
66
|
+
self.dependency 'rake-compiler-dock', ['~> 1.0'], :developer
|
65
67
|
self.dependency 'hoe-deveiate', '~> 0.9', :developer
|
66
68
|
self.dependency 'hoe-bundler', '~> 1.0', :developer
|
67
69
|
self.dependency 'rspec', '~> 3.5', :developer
|
@@ -69,7 +71,7 @@ $hoespec = Hoe.spec 'pg' do
|
|
69
71
|
|
70
72
|
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
|
71
73
|
|
72
|
-
self.require_ruby_version( '>= 2.
|
74
|
+
self.require_ruby_version( '>= 2.2' )
|
73
75
|
|
74
76
|
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
75
77
|
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
@@ -129,7 +131,7 @@ Rake::ExtensionTask.new do |ext|
|
|
129
131
|
|
130
132
|
# Add libpq.dll to windows binary gemspec
|
131
133
|
ext.cross_compiling do |spec|
|
132
|
-
spec.files << "lib/libpq.dll"
|
134
|
+
spec.files << "lib/#{spec.platform}/libpq.dll"
|
133
135
|
end
|
134
136
|
end
|
135
137
|
|
@@ -184,7 +186,7 @@ end
|
|
184
186
|
|
185
187
|
desc "Update list of server error codes"
|
186
188
|
task :update_error_codes do
|
187
|
-
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/
|
189
|
+
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_12_0"
|
188
190
|
|
189
191
|
ERRORCODES_TXT = "ext/errorcodes.txt"
|
190
192
|
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
data/Rakefile.cross
CHANGED
@@ -29,8 +29,8 @@ class CrossLibrary < OpenStruct
|
|
29
29
|
self.host_platform = toolchain
|
30
30
|
|
31
31
|
# Cross-compilation constants
|
32
|
-
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.
|
33
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '
|
32
|
+
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1d'
|
33
|
+
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '12.1'
|
34
34
|
|
35
35
|
# Check if symlinks work in the current working directory.
|
36
36
|
# This fails, if rake-compiler-dock is running on a Windows box.
|
@@ -45,6 +45,8 @@ class CrossLibrary < OpenStruct
|
|
45
45
|
end
|
46
46
|
self.static_sourcesdir = compile_home + 'sources'
|
47
47
|
self.static_builddir = compile_home + 'builds' + for_platform
|
48
|
+
CLOBBER.include( static_sourcesdir )
|
49
|
+
CLEAN.include( static_builddir )
|
48
50
|
|
49
51
|
# Static OpenSSL build vars
|
50
52
|
self.static_openssl_builddir = static_builddir + "openssl-#{openssl_version}"
|
@@ -141,9 +143,9 @@ class CrossLibrary < OpenStruct
|
|
141
143
|
end
|
142
144
|
|
143
145
|
desc "compile static openssl libraries"
|
144
|
-
task
|
146
|
+
task "openssl_libs:#{for_platform}" => [ libssl, libcrypto ]
|
145
147
|
|
146
|
-
task
|
148
|
+
task "compile_static_openssl:#{for_platform}" => openssl_makefile do |t|
|
147
149
|
chdir( static_openssl_builddir ) do
|
148
150
|
cmd = cmd_prelude.dup
|
149
151
|
cmd << 'make' << "-j#{NUM_CPUS}" << 'build_libs'
|
@@ -153,12 +155,12 @@ class CrossLibrary < OpenStruct
|
|
153
155
|
end
|
154
156
|
|
155
157
|
desc "compile static #{libssl}"
|
156
|
-
file libssl =>
|
158
|
+
file libssl => "compile_static_openssl:#{for_platform}" do |t|
|
157
159
|
rm t.name.gsub(/\.a$/, ".dll.a")
|
158
160
|
end
|
159
161
|
|
160
162
|
desc "compile static #{libcrypto}"
|
161
|
-
file libcrypto =>
|
163
|
+
file libcrypto => "compile_static_openssl:#{for_platform}" do |t|
|
162
164
|
rm t.name.gsub(/\.a$/, ".dll.a")
|
163
165
|
end
|
164
166
|
|
@@ -189,7 +191,7 @@ class CrossLibrary < OpenStruct
|
|
189
191
|
end
|
190
192
|
|
191
193
|
# generate the makefile in a clean build location
|
192
|
-
file postgresql_global_makefile => [ static_postgresql_builddir,
|
194
|
+
file postgresql_global_makefile => [ static_postgresql_builddir, "openssl_libs:#{for_platform}" ] do |t|
|
193
195
|
options = [
|
194
196
|
"--target=#{host_platform}",
|
195
197
|
"--host=#{host_platform}",
|
@@ -217,6 +219,9 @@ class CrossLibrary < OpenStruct
|
|
217
219
|
chdir( static_postgresql_srcdir + "common" ) do
|
218
220
|
sh 'make', "-j#{NUM_CPUS}"
|
219
221
|
end
|
222
|
+
chdir( static_postgresql_srcdir + "port" ) do
|
223
|
+
sh 'make', "-j#{NUM_CPUS}"
|
224
|
+
end
|
220
225
|
|
221
226
|
chdir( postgresql_lib.dirname ) do
|
222
227
|
sh 'make',
|
@@ -228,10 +233,10 @@ class CrossLibrary < OpenStruct
|
|
228
233
|
|
229
234
|
|
230
235
|
#desc 'compile libpg.a'
|
231
|
-
task
|
236
|
+
task "native:#{for_platform}" => postgresql_lib
|
232
237
|
|
233
238
|
# copy libpq.dll to lib dir
|
234
|
-
dest_libpq = "lib/#{postgresql_lib.basename}"
|
239
|
+
dest_libpq = "lib/#{for_platform}/#{postgresql_lib.basename}"
|
235
240
|
directory File.dirname(dest_libpq)
|
236
241
|
file dest_libpq => [postgresql_lib, File.dirname(dest_libpq)] do
|
237
242
|
cp postgresql_lib, dest_libpq
|
@@ -245,20 +250,15 @@ class CrossLibrary < OpenStruct
|
|
245
250
|
end
|
246
251
|
end
|
247
252
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
CrossLibrary.new platform, openssl_config, toolchain
|
254
|
-
end
|
255
|
-
else
|
256
|
-
$stderr.puts "Cross-compilation disabled -- rake-compiler not properly installed"
|
257
|
-
CrossLibraries = []
|
253
|
+
CrossLibraries = [
|
254
|
+
['x86-mingw32', 'mingw', 'i686-w64-mingw32'],
|
255
|
+
['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
|
256
|
+
].map do |platform, openssl_config, toolchain|
|
257
|
+
CrossLibrary.new platform, openssl_config, toolchain
|
258
258
|
end
|
259
259
|
|
260
260
|
desc 'cross compile pg for win32'
|
261
|
-
task :cross => [ :mingw32
|
261
|
+
task :cross => [ :mingw32 ]
|
262
262
|
|
263
263
|
task :mingw32 do
|
264
264
|
# Use Rake::ExtensionCompiler helpers to find the proper host
|
@@ -269,30 +269,32 @@ task :mingw32 do
|
|
269
269
|
end
|
270
270
|
end
|
271
271
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
272
|
+
task 'gem:windows:prepare' do
|
273
|
+
require 'io/console'
|
274
|
+
require 'rake_compiler_dock'
|
275
|
+
|
276
|
+
# Copy gem signing key and certs to be accessable from the docker container
|
277
|
+
mkdir_p 'build/gem'
|
278
|
+
sh "cp ~/.gem/gem-*.pem build/gem/ || true"
|
279
|
+
sh "bundle package"
|
280
|
+
begin
|
281
|
+
OpenSSL::PKey.read(File.read(File.expand_path("~/.gem/gem-private_key.pem")), ENV["GEM_PRIVATE_KEY_PASSPHRASE"] || "")
|
282
|
+
rescue OpenSSL::PKey::PKeyError
|
283
|
+
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
|
284
|
+
retry
|
285
|
+
end
|
281
286
|
end
|
282
287
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
bundle install --local &&
|
296
|
-
rake cross native gem MAKE="make -j`nproc`"
|
297
|
-
EOT
|
288
|
+
CrossLibraries.each do |xlib|
|
289
|
+
platform = xlib.for_platform
|
290
|
+
desc "Build fat binary gem for platform #{platform}"
|
291
|
+
task "gem:windows:#{platform}" => ['ChangeLog', 'gem:windows:prepare', xlib.openssl_tarball, xlib.postgresql_tarball] do
|
292
|
+
RakeCompilerDock.sh <<-EOT, platform: platform
|
293
|
+
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
294
|
+
bundle install --local &&
|
295
|
+
rake native:#{platform} pkg/#{$hoespec.spec.full_name}-#{platform}.gem MAKE="make -j`nproc`"
|
296
|
+
EOT
|
297
|
+
end
|
298
|
+
desc "Build the windows binary gems"
|
299
|
+
multitask 'gem:windows' => "gem:windows:#{platform}"
|
298
300
|
end
|
data/ext/errorcodes.def
CHANGED
@@ -302,6 +302,66 @@
|
|
302
302
|
VALUE klass = define_error_class( "InvalidXmlProcessingInstruction", "22" );
|
303
303
|
register_error_class( "2200T", klass );
|
304
304
|
}
|
305
|
+
{
|
306
|
+
VALUE klass = define_error_class( "DuplicateJsonObjectKeyValue", "22" );
|
307
|
+
register_error_class( "22030", klass );
|
308
|
+
}
|
309
|
+
{
|
310
|
+
VALUE klass = define_error_class( "InvalidJsonText", "22" );
|
311
|
+
register_error_class( "22032", klass );
|
312
|
+
}
|
313
|
+
{
|
314
|
+
VALUE klass = define_error_class( "InvalidSqlJsonSubscript", "22" );
|
315
|
+
register_error_class( "22033", klass );
|
316
|
+
}
|
317
|
+
{
|
318
|
+
VALUE klass = define_error_class( "MoreThanOneSqlJsonItem", "22" );
|
319
|
+
register_error_class( "22034", klass );
|
320
|
+
}
|
321
|
+
{
|
322
|
+
VALUE klass = define_error_class( "NoSqlJsonItem", "22" );
|
323
|
+
register_error_class( "22035", klass );
|
324
|
+
}
|
325
|
+
{
|
326
|
+
VALUE klass = define_error_class( "NonNumericSqlJsonItem", "22" );
|
327
|
+
register_error_class( "22036", klass );
|
328
|
+
}
|
329
|
+
{
|
330
|
+
VALUE klass = define_error_class( "NonUniqueKeysInAJsonObject", "22" );
|
331
|
+
register_error_class( "22037", klass );
|
332
|
+
}
|
333
|
+
{
|
334
|
+
VALUE klass = define_error_class( "SingletonSqlJsonItemRequired", "22" );
|
335
|
+
register_error_class( "22038", klass );
|
336
|
+
}
|
337
|
+
{
|
338
|
+
VALUE klass = define_error_class( "SqlJsonArrayNotFound", "22" );
|
339
|
+
register_error_class( "22039", klass );
|
340
|
+
}
|
341
|
+
{
|
342
|
+
VALUE klass = define_error_class( "SqlJsonMemberNotFound", "22" );
|
343
|
+
register_error_class( "2203A", klass );
|
344
|
+
}
|
345
|
+
{
|
346
|
+
VALUE klass = define_error_class( "SqlJsonNumberNotFound", "22" );
|
347
|
+
register_error_class( "2203B", klass );
|
348
|
+
}
|
349
|
+
{
|
350
|
+
VALUE klass = define_error_class( "SqlJsonObjectNotFound", "22" );
|
351
|
+
register_error_class( "2203C", klass );
|
352
|
+
}
|
353
|
+
{
|
354
|
+
VALUE klass = define_error_class( "TooManyJsonArrayElements", "22" );
|
355
|
+
register_error_class( "2203D", klass );
|
356
|
+
}
|
357
|
+
{
|
358
|
+
VALUE klass = define_error_class( "TooManyJsonObjectMembers", "22" );
|
359
|
+
register_error_class( "2203E", klass );
|
360
|
+
}
|
361
|
+
{
|
362
|
+
VALUE klass = define_error_class( "SqlJsonScalarRequired", "22" );
|
363
|
+
register_error_class( "2203F", klass );
|
364
|
+
}
|
305
365
|
{
|
306
366
|
VALUE klass = define_error_class( "IntegrityConstraintViolation", NULL );
|
307
367
|
register_error_class( "23000", klass );
|
@@ -767,6 +827,10 @@
|
|
767
827
|
VALUE klass = define_error_class( "LockNotAvailable", "55" );
|
768
828
|
register_error_class( "55P03", klass );
|
769
829
|
}
|
830
|
+
{
|
831
|
+
VALUE klass = define_error_class( "UnsafeNewEnumValueUsage", "55" );
|
832
|
+
register_error_class( "55P04", klass );
|
833
|
+
}
|
770
834
|
{
|
771
835
|
VALUE klass = define_error_class( "OperatorIntervention", NULL );
|
772
836
|
register_error_class( "57000", klass );
|