pg 0.18.0.pre20141017160319-x64-mingw32 → 0.18.0.pre20141117110243-x64-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/ChangeLog +317 -235
- data/History.rdoc +15 -0
- data/Manifest.txt +2 -0
- data/README.rdoc +1 -1
- data/ext/extconf.rb +2 -0
- data/ext/pg.c +66 -0
- data/ext/pg.h +50 -13
- data/ext/pg_binary_decoder.c +3 -3
- data/ext/pg_coder.c +6 -0
- data/ext/pg_connection.c +49 -54
- data/ext/pg_copy_coder.c +13 -29
- data/ext/pg_errors.c +6 -0
- data/ext/pg_result.c +272 -76
- data/ext/pg_text_encoder.c +43 -0
- data/ext/pg_type_map.c +84 -13
- data/ext/pg_type_map_all_strings.c +15 -12
- data/ext/pg_type_map_by_class.c +239 -0
- data/ext/pg_type_map_by_column.c +80 -22
- data/ext/pg_type_map_by_mri_type.c +41 -23
- data/ext/pg_type_map_by_oid.c +51 -19
- data/lib/2.0/pg_ext.so +0 -0
- data/lib/2.1/pg_ext.so +0 -0
- data/lib/pg.rb +2 -2
- data/lib/pg/basic_type_mapping.rb +13 -13
- data/lib/pg/coder.rb +9 -0
- data/lib/x64-mingw32/libpq.dll +0 -0
- data/spec/helpers.rb +5 -3
- data/spec/pg/basic_type_mapping_spec.rb +1 -1
- data/spec/pg/connection_spec.rb +16 -5
- data/spec/pg/result_spec.rb +77 -3
- data/spec/pg/type_map_by_class_spec.rb +138 -0
- data/spec/pg/type_map_by_column_spec.rb +87 -0
- data/spec/pg/type_map_by_mri_type_spec.rb +14 -0
- data/spec/pg/type_map_by_oid_spec.rb +21 -0
- data/spec/pg/type_spec.rb +27 -7
- data/spec/pg_spec.rb +14 -0
- metadata +24 -21
- metadata.gz.sig +0 -0
@@ -87,6 +87,20 @@ describe PG::TypeMapByMriType do
|
|
87
87
|
expect{ tm[123] = textenc_float }.to raise_error(TypeError)
|
88
88
|
end
|
89
89
|
|
90
|
+
it "forwards query param conversions to the #default_type_map" do
|
91
|
+
tm1 = PG::TypeMapByColumn.new( [textenc_int, nil, nil] )
|
92
|
+
|
93
|
+
tm2 = PG::TypeMapByMriType.new
|
94
|
+
tm2['T_FIXNUM'] = PG::TextEncoder::Integer.new name: 'INT2', oid: 21
|
95
|
+
tm2.default_type_map = tm1
|
96
|
+
|
97
|
+
res = @conn.exec_params( "SELECT $1, $2, $3::TEXT", ['1', 2, 3], 0, tm2 )
|
98
|
+
|
99
|
+
expect( res.ftype(0) ).to eq( 23 ) # tm1
|
100
|
+
expect( res.ftype(1) ).to eq( 21 ) # tm2
|
101
|
+
expect( res.getvalue(0,2) ).to eq( "3" ) # TypeMapAllStrings
|
102
|
+
end
|
103
|
+
|
90
104
|
#
|
91
105
|
# Decoding Examples
|
92
106
|
#
|
@@ -85,6 +85,27 @@ describe PG::TypeMapByOid do
|
|
85
85
|
expect( tm2.coders ).to eq( [textdec_int, nil, textdec_float, pass_through_type] )
|
86
86
|
end
|
87
87
|
|
88
|
+
it "forwards result value conversions to another TypeMapByOid as #default_type_map" do
|
89
|
+
# One run with implicit built TypeMapByColumn and another with online lookup
|
90
|
+
# for each type map.
|
91
|
+
[[0, 0], [0, 10], [10, 0], [10, 10]].each do |max_rows1, max_rows2|
|
92
|
+
tm1 = PG::TypeMapByOid.new
|
93
|
+
tm1.add_coder PG::TextDecoder::Integer.new name: 'INT2', oid: 21
|
94
|
+
tm1.max_rows_for_online_lookup = max_rows1
|
95
|
+
|
96
|
+
tm2 = PG::TypeMapByOid.new
|
97
|
+
tm2.add_coder PG::TextDecoder::Integer.new name: 'INT4', oid: 23
|
98
|
+
tm2.max_rows_for_online_lookup = max_rows2
|
99
|
+
tm2.default_type_map = tm1
|
100
|
+
|
101
|
+
res = @conn.exec( "SELECT '1'::INT4, '2'::INT2, '3'::INT8" ).map_types!( tm2 )
|
102
|
+
|
103
|
+
expect( res.getvalue(0,0) ).to eq( 1 ) # tm2
|
104
|
+
expect( res.getvalue(0,1) ).to eq( 2 ) # tm1
|
105
|
+
expect( res.getvalue(0,2) ).to eq( "3" ) # TypeMapAllStrings
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
88
109
|
#
|
89
110
|
# Decoding Examples text format
|
90
111
|
#
|
data/spec/pg/type_spec.rb
CHANGED
@@ -15,6 +15,7 @@ describe "PG::Type derivations" do
|
|
15
15
|
let!(:textdec_string) { PG::TextDecoder::String.new }
|
16
16
|
let!(:textenc_timestamp) { PG::TextEncoder::TimestampWithoutTimeZone.new }
|
17
17
|
let!(:textdec_timestamp) { PG::TextDecoder::TimestampWithoutTimeZone.new }
|
18
|
+
let!(:textenc_bytea) { PG::TextEncoder::Bytea.new }
|
18
19
|
let!(:textdec_bytea) { PG::TextDecoder::Bytea.new }
|
19
20
|
let!(:binaryenc_int2) { PG::BinaryEncoder::Int2.new }
|
20
21
|
let!(:binaryenc_int4) { PG::BinaryEncoder::Int4.new }
|
@@ -92,8 +93,8 @@ describe "PG::Type derivations" do
|
|
92
93
|
end
|
93
94
|
|
94
95
|
it "should pass through nil values" do
|
95
|
-
expect( textdec_string.
|
96
|
-
expect( textdec_int.
|
96
|
+
expect( textdec_string.decode( nil )).to be_nil
|
97
|
+
expect( textdec_int.decode( nil )).to be_nil
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
@@ -155,6 +156,10 @@ describe "PG::Type derivations" do
|
|
155
156
|
expect( textenc_float.encode(-Float::NAN) ).to eq( Float::NAN.to_s )
|
156
157
|
end
|
157
158
|
|
159
|
+
it "encodes binary string to bytea" do
|
160
|
+
expect( textenc_bytea.encode("\x00\x01\x02\x03\xef".b) ).to eq( "\\x00010203ef" )
|
161
|
+
end
|
162
|
+
|
158
163
|
it "should encode with ruby encoder" do
|
159
164
|
expect( intenc_incrementer.encode(3) ).to eq( "4 " )
|
160
165
|
end
|
@@ -192,6 +197,21 @@ describe "PG::Type derivations" do
|
|
192
197
|
expect( t.format ).to eq( 0 )
|
193
198
|
expect( t.oid ).to eq( 0 )
|
194
199
|
expect( t.name ).to be_nil
|
200
|
+
|
201
|
+
t = PG::BinaryEncoder::Int4.new
|
202
|
+
expect( t.format ).to eq( 1 )
|
203
|
+
expect( t.oid ).to eq( 0 )
|
204
|
+
expect( t.name ).to be_nil
|
205
|
+
|
206
|
+
t = PG::TextDecoder::String.new
|
207
|
+
expect( t.format ).to eq( 0 )
|
208
|
+
expect( t.oid ).to eq( 0 )
|
209
|
+
expect( t.name ).to be_nil
|
210
|
+
|
211
|
+
t = PG::BinaryDecoder::String.new
|
212
|
+
expect( t.format ).to eq( 1 )
|
213
|
+
expect( t.oid ).to eq( 0 )
|
214
|
+
expect( t.name ).to be_nil
|
195
215
|
end
|
196
216
|
end
|
197
217
|
|
@@ -565,12 +585,12 @@ describe "PG::Type derivations" do
|
|
565
585
|
end
|
566
586
|
end
|
567
587
|
|
568
|
-
context "with
|
588
|
+
context "with TypeMapByClass" do
|
569
589
|
let!(:tm) do
|
570
|
-
tm = PG::
|
571
|
-
tm[
|
572
|
-
tm[
|
573
|
-
tm[
|
590
|
+
tm = PG::TypeMapByClass.new
|
591
|
+
tm[Integer] = textenc_int
|
592
|
+
tm[Float] = intenc_incrementer
|
593
|
+
tm[Array] = PG::TextEncoder::Array.new elements_type: textenc_string
|
574
594
|
tm
|
575
595
|
end
|
576
596
|
let!(:encoder) do
|
data/spec/pg_spec.rb
CHANGED
@@ -12,6 +12,20 @@ describe PG do
|
|
12
12
|
expect( PG.library_version ).to be >= 90100
|
13
13
|
end
|
14
14
|
|
15
|
+
it "can select which of both security libraries to initialize" do
|
16
|
+
# This setting does nothing here, because there is already a connection
|
17
|
+
# to the server, at this point in time.
|
18
|
+
PG.init_openssl(false, true)
|
19
|
+
PG.init_openssl(1, 0)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "can select whether security libraries to initialize" do
|
23
|
+
# This setting does nothing here, because there is already a connection
|
24
|
+
# to the server, at this point in time.
|
25
|
+
PG.init_ssl(false)
|
26
|
+
PG.init_ssl(1)
|
27
|
+
end
|
28
|
+
|
15
29
|
|
16
30
|
it "knows whether or not the library is threadsafe" do
|
17
31
|
expect( PG ).to be_threadsafe()
|
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: 0.18.0.
|
4
|
+
version: 0.18.0.pre20141117110243
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -11,26 +11,26 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
14
|
+
MIIDLjCCAhagAwIBAgIBAjANBgkqhkiG9w0BAQUFADA9MQ4wDAYDVQQDDAVrYW5p
|
15
|
+
czEXMBUGCgmSJomT8ixkARkWB2NvbWNhcmQxEjAQBgoJkiaJk/IsZAEZFgJkZTAe
|
16
|
+
Fw0xNDAyMjYwOTMzMDBaFw0xNTAyMjYwOTMzMDBaMD0xDjAMBgNVBAMMBWthbmlz
|
17
|
+
MRcwFQYKCZImiZPyLGQBGRYHY29tY2FyZDESMBAGCgmSJomT8ixkARkWAmRlMIIB
|
18
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApop+rNmg35bzRugZ21VMGqI6
|
19
|
+
HGzPLO4VHYncWn/xmgPU/ZMcZdfj6MzIaZJ/czXyt4eHpBk1r8QOV3gBXnRXEjVW
|
20
|
+
9xi+EdVOkTV2/AVFKThcbTAQGiF/bT1n2M+B1GTybRzMg6hyhOJeGPqIhLfJEpxn
|
21
|
+
lJi4+ENAVT4MpqHEAGB8yFoPC0GqiOHQsdHxQV3P3c2OZqG+yJey74QtwA2tLcLn
|
22
|
+
Q53c63+VLGsOjODl1yPn/2ejyq8qWu6ahfTxiIlSar2UbwtaQGBDFdb2CXgEufXT
|
23
|
+
L7oaPxlmj+Q2oLOfOnInd2Oxop59HoJCQPsg8f921J43NCQGA8VHK6paxIRDLQID
|
24
|
+
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUvgTdT7fe
|
25
|
+
x17ugO3IOsjEJwW7KP4wDQYJKoZIhvcNAQEFBQADggEBAFmIAhRT0awqLQN9e4Uv
|
26
|
+
ZEk+jUWv4zkb+TWiKFJXlwjPyjGbZY9gVfOwAwMibYOK/t/+57ZzW3d0L12OUwvo
|
27
|
+
on84NVvYtIr1/iskJFWFkMoIquAFCdi9p68stSPMQK2XcrJJuRot29fJtropsZBa
|
28
|
+
2cpaNd/sRYdK4oep2usdKifA1lI0hIkPb3r5nLfwG2lAqBH7WZsUICHcTgR0VEbG
|
29
|
+
z9Ug5qQp9Uz73xC9YdGvGiuOX53LYobHAR4MWi2xxDlHI+ER8mRz0eY2FUuNu/Wj
|
30
|
+
GrqF74zpLl7/KFdHC8VmzwZS18hvDjxeLVuVI2gIGnBInqnlqv05g/l4/1pISh5j
|
31
|
+
dS4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-
|
33
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: hoe-mercurial
|
@@ -193,6 +193,7 @@ extra_rdoc_files:
|
|
193
193
|
- ext/pg_text_encoder.c
|
194
194
|
- ext/pg_type_map.c
|
195
195
|
- ext/pg_type_map_all_strings.c
|
196
|
+
- ext/pg_type_map_by_class.c
|
196
197
|
- ext/pg_type_map_by_column.c
|
197
198
|
- ext/pg_type_map_by_mri_type.c
|
198
199
|
- ext/pg_type_map_by_oid.c
|
@@ -231,6 +232,7 @@ files:
|
|
231
232
|
- ext/pg_text_encoder.c
|
232
233
|
- ext/pg_type_map.c
|
233
234
|
- ext/pg_type_map_all_strings.c
|
235
|
+
- ext/pg_type_map_by_class.c
|
234
236
|
- ext/pg_type_map_by_column.c
|
235
237
|
- ext/pg_type_map_by_mri_type.c
|
236
238
|
- ext/pg_type_map_by_oid.c
|
@@ -276,6 +278,7 @@ files:
|
|
276
278
|
- spec/pg/basic_type_mapping_spec.rb
|
277
279
|
- spec/pg/connection_spec.rb
|
278
280
|
- spec/pg/result_spec.rb
|
281
|
+
- spec/pg/type_map_by_class_spec.rb
|
279
282
|
- spec/pg/type_map_by_column_spec.rb
|
280
283
|
- spec/pg/type_map_by_mri_type_spec.rb
|
281
284
|
- spec/pg/type_map_by_oid_spec.rb
|
@@ -310,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
313
|
version: 1.3.1
|
311
314
|
requirements: []
|
312
315
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.
|
316
|
+
rubygems_version: 2.2.2
|
314
317
|
signing_key:
|
315
318
|
specification_version: 4
|
316
319
|
summary: Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]
|
metadata.gz.sig
CHANGED
Binary file
|