pg 0.18.4-x86-mingw32 → 0.19.0.pre20160817083826-x86-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 +686 -167
- data/History.rdoc +23 -0
- data/README.rdoc +6 -6
- data/Rakefile +10 -12
- data/Rakefile.cross +6 -6
- data/ext/errorcodes.def +16 -0
- data/ext/errorcodes.txt +5 -1
- data/ext/extconf.rb +9 -1
- data/ext/gvl_wrappers.h +4 -0
- data/ext/pg.c +1 -1
- data/ext/pg.h +6 -3
- data/ext/pg_binary_decoder.c +1 -1
- data/ext/pg_binary_encoder.c +8 -8
- data/ext/pg_coder.c +30 -9
- data/ext/pg_connection.c +203 -77
- data/ext/pg_copy_coder.c +34 -4
- data/ext/pg_result.c +2 -2
- data/ext/pg_text_decoder.c +1 -1
- data/ext/pg_text_encoder.c +62 -42
- data/ext/pg_type_map.c +1 -1
- data/ext/pg_type_map_all_strings.c +1 -1
- data/ext/pg_type_map_by_class.c +1 -1
- data/ext/pg_type_map_by_column.c +1 -1
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +1 -1
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/ext/util.c +1 -1
- data/lib/1.9/pg_ext.so +0 -0
- data/lib/2.0/pg_ext.so +0 -0
- data/lib/2.1/pg_ext.so +0 -0
- data/lib/2.2/pg_ext.so +0 -0
- data/lib/2.3/pg_ext.so +0 -0
- data/lib/libpq.dll +0 -0
- data/lib/pg.rb +3 -3
- data/lib/pg/basic_type_mapping.rb +35 -8
- data/lib/pg/connection.rb +46 -6
- data/lib/pg/result.rb +6 -2
- data/lib/pg/text_decoder.rb +7 -0
- data/lib/pg/text_encoder.rb +8 -0
- data/sample/disk_usage_report.rb +1 -1
- data/sample/pg_statistics.rb +1 -1
- data/sample/replication_monitor.rb +1 -1
- data/spec/helpers.rb +6 -9
- data/spec/pg/basic_type_mapping_spec.rb +54 -0
- data/spec/pg/connection_spec.rb +130 -23
- data/spec/pg/type_map_by_class_spec.rb +1 -1
- data/spec/pg/type_map_by_mri_type_spec.rb +1 -1
- data/spec/pg/type_spec.rb +82 -2
- metadata +33 -35
- metadata.gz.sig +0 -0
- data/lib/i386-mingw32/libpq.dll +0 -0
@@ -102,7 +102,7 @@ describe PG::TypeMapByClass do
|
|
102
102
|
|
103
103
|
it "should allow mixed type conversions" do
|
104
104
|
res = @conn.exec_params( "SELECT $1, $2, $3", [5, 1.23, :TestSymbol], 0, tm )
|
105
|
-
expect( res.values ).to eq([['5', '1.23',
|
105
|
+
expect( res.values ).to eq([['5', '1.23', "[:TestSymbol, #{@conn.internal_encoding.inspect}]"]])
|
106
106
|
expect( res.ftype(0) ).to eq(20)
|
107
107
|
end
|
108
108
|
|
@@ -116,7 +116,7 @@ describe PG::TypeMapByMriType do
|
|
116
116
|
|
117
117
|
it "should allow mixed type conversions" do
|
118
118
|
res = @conn.exec_params( "SELECT $1, $2, $3", [5, 1.23, :TestSymbol], 0, tm )
|
119
|
-
expect( res.values ).to eq([['5', '1.23',
|
119
|
+
expect( res.values ).to eq([['5', '1.23', "[:TestSymbol, #{@conn.internal_encoding.inspect}]"]])
|
120
120
|
expect( res.ftype(0) ).to eq(20)
|
121
121
|
end
|
122
122
|
|
data/spec/pg/type_spec.rb
CHANGED
@@ -39,6 +39,14 @@ describe "PG::Type derivations" do
|
|
39
39
|
end.new
|
40
40
|
end
|
41
41
|
|
42
|
+
let!(:intenc_incrementer_with_encoding) do
|
43
|
+
Class.new(PG::SimpleEncoder) do
|
44
|
+
def encode(value, encoding)
|
45
|
+
r = (value.to_i + 1).to_s + " #{encoding}"
|
46
|
+
r.encode!(encoding)
|
47
|
+
end
|
48
|
+
end.new
|
49
|
+
end
|
42
50
|
let!(:intenc_incrementer_with_int_result) do
|
43
51
|
Class.new(PG::SimpleEncoder) do
|
44
52
|
def encode(value)
|
@@ -127,6 +135,13 @@ describe "PG::Type derivations" do
|
|
127
135
|
expect( quoted_type.decode(%[a.b]) ).to eq( ['a','b'] )
|
128
136
|
expect( quoted_type.decode(%[a]) ).to eq( ['a'] )
|
129
137
|
end
|
138
|
+
|
139
|
+
it 'should split identifier string with correct character encoding' do
|
140
|
+
quoted_type = PG::TextDecoder::Identifier.new
|
141
|
+
v = quoted_type.decode(%[Héllo].encode("iso-8859-1")).first
|
142
|
+
expect( v.encoding ).to eq( Encoding::ISO_8859_1 )
|
143
|
+
expect( v ).to eq( %[Héllo].encode(Encoding::ISO_8859_1) )
|
144
|
+
end
|
130
145
|
end
|
131
146
|
|
132
147
|
it "should raise when decode method is called with wrong args" do
|
@@ -209,6 +224,13 @@ describe "PG::Type derivations" do
|
|
209
224
|
expect( quoted_type.encode( nil ) ).to be_nil
|
210
225
|
end
|
211
226
|
|
227
|
+
it 'should quote identifiers with correct character encoding' do
|
228
|
+
quoted_type = PG::TextEncoder::Identifier.new
|
229
|
+
v = quoted_type.encode(['Héllo'], "iso-8859-1")
|
230
|
+
expect( v ).to eq( %["Héllo"].encode(Encoding::ISO_8859_1) )
|
231
|
+
expect( v.encoding ).to eq( Encoding::ISO_8859_1 )
|
232
|
+
end
|
233
|
+
|
212
234
|
it "will raise a TypeError for invalid arguments to quote_ident" do
|
213
235
|
quoted_type = PG::TextEncoder::Identifier.new
|
214
236
|
expect{ quoted_type.encode( [nil] ) }.to raise_error(TypeError)
|
@@ -220,6 +242,12 @@ describe "PG::Type derivations" do
|
|
220
242
|
expect( intenc_incrementer.encode(3) ).to eq( "4 " )
|
221
243
|
end
|
222
244
|
|
245
|
+
it "should encode with ruby encoder and given character encoding" do
|
246
|
+
r = intenc_incrementer_with_encoding.encode(3, Encoding::CP850)
|
247
|
+
expect( r ).to eq( "4 CP850" )
|
248
|
+
expect( r.encoding ).to eq( Encoding::CP850 )
|
249
|
+
end
|
250
|
+
|
223
251
|
it "should return when ruby encoder returns non string values" do
|
224
252
|
expect( intenc_incrementer_with_int_result.encode(3) ).to eq( 4 )
|
225
253
|
end
|
@@ -447,9 +475,18 @@ describe "PG::Type derivations" do
|
|
447
475
|
end
|
448
476
|
|
449
477
|
context 'array of types with encoder in ruby space' do
|
450
|
-
it 'encodes with quotation' do
|
478
|
+
it 'encodes with quotation and default character encoding' do
|
479
|
+
array_type = PG::TextEncoder::Array.new elements_type: intenc_incrementer, needs_quotation: true
|
480
|
+
r = array_type.encode([3,4])
|
481
|
+
expect( r ).to eq( %[{"4 ","5 "}] )
|
482
|
+
expect( r.encoding ).to eq( Encoding::ASCII_8BIT )
|
483
|
+
end
|
484
|
+
|
485
|
+
it 'encodes with quotation and given character encoding' do
|
451
486
|
array_type = PG::TextEncoder::Array.new elements_type: intenc_incrementer, needs_quotation: true
|
452
|
-
|
487
|
+
r = array_type.encode([3,4], Encoding::CP850)
|
488
|
+
expect( r ).to eq( %[{"4 ","5 "}] )
|
489
|
+
expect( r.encoding ).to eq( Encoding::CP850 )
|
453
490
|
end
|
454
491
|
|
455
492
|
it 'encodes without quotation' do
|
@@ -457,6 +494,20 @@ describe "PG::Type derivations" do
|
|
457
494
|
expect( array_type.encode([3,4]) ).to eq( %[{4 ,5 }] )
|
458
495
|
end
|
459
496
|
|
497
|
+
it 'encodes with default character encoding' do
|
498
|
+
array_type = PG::TextEncoder::Array.new elements_type: intenc_incrementer_with_encoding
|
499
|
+
r = array_type.encode([3,4])
|
500
|
+
expect( r ).to eq( %[{"4 ASCII-8BIT","5 ASCII-8BIT"}] )
|
501
|
+
expect( r.encoding ).to eq( Encoding::ASCII_8BIT )
|
502
|
+
end
|
503
|
+
|
504
|
+
it 'encodes with given character encoding' do
|
505
|
+
array_type = PG::TextEncoder::Array.new elements_type: intenc_incrementer_with_encoding
|
506
|
+
r = array_type.encode([3,4], Encoding::CP850)
|
507
|
+
expect( r ).to eq( %[{"4 CP850","5 CP850"}] )
|
508
|
+
expect( r.encoding ).to eq( Encoding::CP850 )
|
509
|
+
end
|
510
|
+
|
460
511
|
it "should raise when ruby encoder returns non string values" do
|
461
512
|
array_type = PG::TextEncoder::Array.new elements_type: intenc_incrementer_with_int_result, needs_quotation: false
|
462
513
|
expect{ array_type.encode([3,4]) }.to raise_error(TypeError)
|
@@ -473,6 +524,13 @@ describe "PG::Type derivations" do
|
|
473
524
|
quoted_type = PG::TextEncoder::QuotedLiteral.new elements_type: textenc_string_array
|
474
525
|
expect( quoted_type.encode(["'A\",","\\B'"]) ).to eq( %['{"''A\\",","\\\\B''"}'] )
|
475
526
|
end
|
527
|
+
|
528
|
+
it 'should quote literals with correct character encoding' do
|
529
|
+
quoted_type = PG::TextEncoder::QuotedLiteral.new elements_type: textenc_string_array
|
530
|
+
v = quoted_type.encode(["Héllo"], "iso-8859-1")
|
531
|
+
expect( v.encoding ).to eq( Encoding::ISO_8859_1 )
|
532
|
+
expect( v ).to eq( %['{Héllo}'].encode(Encoding::ISO_8859_1) )
|
533
|
+
end
|
476
534
|
end
|
477
535
|
end
|
478
536
|
|
@@ -522,9 +580,19 @@ describe "PG::Type derivations" do
|
|
522
580
|
expect( e.encode("(\xFBm") ).to eq("KPtt")
|
523
581
|
end
|
524
582
|
|
583
|
+
it 'should encode Strings as base64 with correct character encoding' do
|
584
|
+
e = PG::TextEncoder::ToBase64.new
|
585
|
+
v = e.encode("Héllo".encode("utf-16le"), "iso-8859-1")
|
586
|
+
expect( v ).to eq("SOlsbG8=")
|
587
|
+
expect( v.encoding ).to eq(Encoding::ISO_8859_1)
|
588
|
+
end
|
589
|
+
|
525
590
|
it "should encode Strings as base64 in BinaryDecoder" do
|
526
591
|
e = PG::BinaryDecoder::ToBase64.new
|
527
592
|
expect( e.decode("x") ).to eq("eA==")
|
593
|
+
v = e.decode("Héllo".encode("utf-16le"))
|
594
|
+
expect( v ).to eq("SADpAGwAbABvAA==")
|
595
|
+
expect( v.encoding ).to eq(Encoding::ASCII_8BIT)
|
528
596
|
end
|
529
597
|
|
530
598
|
it "should encode Integers as base64" do
|
@@ -611,6 +679,12 @@ describe "PG::Type derivations" do
|
|
611
679
|
expect( encoder.encode([:xyz, 123, 2456, 34567, 456789, 5678901, [1,2,3], 12.1, "abcdefg", nil]) ).
|
612
680
|
to eq("xyz\t123\t2456\t34567\t456789\t5678901\t[1, 2, 3]\t12.1\tabcdefg\t\\N\n")
|
613
681
|
end
|
682
|
+
|
683
|
+
it 'should output a string with correct character encoding' do
|
684
|
+
v = encoder.encode(["Héllo"], "iso-8859-1")
|
685
|
+
expect( v.encoding ).to eq( Encoding::ISO_8859_1 )
|
686
|
+
expect( v ).to eq( "Héllo\n".encode(Encoding::ISO_8859_1) )
|
687
|
+
end
|
614
688
|
end
|
615
689
|
|
616
690
|
context "with TypeMapByClass" do
|
@@ -675,6 +749,12 @@ describe "PG::Type derivations" do
|
|
675
749
|
it "should decode different types of Ruby objects" do
|
676
750
|
expect( decoder.decode("123\t \0#\t#\n#\r#\\ \t234\t#\x01#\002\n".gsub("#", "\\"))).to eq( ["123", " \0\t\n\r\\ ", "234", "\x01\x02"] )
|
677
751
|
end
|
752
|
+
|
753
|
+
it 'should respect input character encoding' do
|
754
|
+
v = decoder.decode("Héllo\n".encode("iso-8859-1")).first
|
755
|
+
expect( v.encoding ).to eq(Encoding::ISO_8859_1)
|
756
|
+
expect( v ).to eq("Héllo".encode("iso-8859-1"))
|
757
|
+
end
|
678
758
|
end
|
679
759
|
end
|
680
760
|
|
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.
|
4
|
+
version: 0.19.0.pre20160817083826
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -11,27 +11,26 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
+
|
20
|
-
|
21
|
-
|
22
|
-
|
23
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uQm
|
27
|
+
ZlzQY8fDCsGc0lh6YrHbUGg7BoDyTJnRMGBnXGHHsXSIYpmC7x+qAxp8xf1AvvEl
|
28
|
+
kmcb7LJN+2QzrpgJmDpNIPJMejM5NOvg1e+qvpNWpOf1u/S0HMpw4u4I99wbiZSo
|
29
|
+
ZQVoPQLB5AFRh5V3qOk6/qF1TxIAQl+OEqUGT7UWv2XYYaZS2FLbK8MqRyWzAYSc
|
30
|
+
PizTJCem24R2bzZN5VGvA5tpqgwytgcFq1PZofgFxK2uKPCS+tmsA8wIjjGzFsnR
|
31
|
+
WfgqWGyHn5K4wejsMic/uA==
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
33
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: hoe-mercurial
|
@@ -53,14 +52,14 @@ dependencies:
|
|
53
52
|
requirements:
|
54
53
|
- - "~>"
|
55
54
|
- !ruby/object:Gem::Version
|
56
|
-
version: '0.
|
55
|
+
version: '0.8'
|
57
56
|
type: :development
|
58
57
|
prerelease: false
|
59
58
|
version_requirements: !ruby/object:Gem::Requirement
|
60
59
|
requirements:
|
61
60
|
- - "~>"
|
62
61
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0.
|
62
|
+
version: '0.8'
|
64
63
|
- !ruby/object:Gem::Dependency
|
65
64
|
name: hoe-highline
|
66
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,14 +108,14 @@ dependencies:
|
|
109
108
|
requirements:
|
110
109
|
- - "~>"
|
111
110
|
- !ruby/object:Gem::Version
|
112
|
-
version: '0.
|
111
|
+
version: '0.5'
|
113
112
|
type: :development
|
114
113
|
prerelease: false
|
115
114
|
version_requirements: !ruby/object:Gem::Requirement
|
116
115
|
requirements:
|
117
116
|
- - "~>"
|
118
117
|
- !ruby/object:Gem::Version
|
119
|
-
version: '0.
|
118
|
+
version: '0.5'
|
120
119
|
- !ruby/object:Gem::Dependency
|
121
120
|
name: hoe
|
122
121
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +161,7 @@ dependencies:
|
|
162
161
|
description: |-
|
163
162
|
Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
|
164
163
|
|
165
|
-
It works with {PostgreSQL
|
164
|
+
It works with {PostgreSQL 9.1 and later}[http://www.postgresql.org/support/versioning/].
|
166
165
|
|
167
166
|
A small example usage:
|
168
167
|
|
@@ -174,7 +173,7 @@ description: |-
|
|
174
173
|
conn = PG.connect( dbname: 'sales' )
|
175
174
|
conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
|
176
175
|
puts " PID | User | Query"
|
177
|
-
|
176
|
+
result.each do |row|
|
178
177
|
puts " %7d | %-16s | %s " %
|
179
178
|
row.values_at('procpid', 'usename', 'current_query')
|
180
179
|
end
|
@@ -262,7 +261,8 @@ files:
|
|
262
261
|
- lib/2.0/pg_ext.so
|
263
262
|
- lib/2.1/pg_ext.so
|
264
263
|
- lib/2.2/pg_ext.so
|
265
|
-
- lib/
|
264
|
+
- lib/2.3/pg_ext.so
|
265
|
+
- lib/libpq.dll
|
266
266
|
- lib/pg.rb
|
267
267
|
- lib/pg/basic_type_mapping.rb
|
268
268
|
- lib/pg/coder.rb
|
@@ -307,9 +307,7 @@ files:
|
|
307
307
|
- spec/pg_spec.rb
|
308
308
|
homepage: https://bitbucket.org/ged/ruby-pg
|
309
309
|
licenses:
|
310
|
-
- BSD
|
311
|
-
- Ruby
|
312
|
-
- GPL
|
310
|
+
- BSD-3-Clause
|
313
311
|
metadata: {}
|
314
312
|
post_install_message:
|
315
313
|
rdoc_options:
|
@@ -321,15 +319,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
321
319
|
requirements:
|
322
320
|
- - ">="
|
323
321
|
- !ruby/object:Gem::Version
|
324
|
-
version:
|
322
|
+
version: 2.0.0
|
325
323
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
326
324
|
requirements:
|
327
|
-
- - "
|
325
|
+
- - ">"
|
328
326
|
- !ruby/object:Gem::Version
|
329
|
-
version:
|
327
|
+
version: 1.3.1
|
330
328
|
requirements: []
|
331
329
|
rubyforge_project:
|
332
|
-
rubygems_version: 2.
|
330
|
+
rubygems_version: 2.5.1
|
333
331
|
signing_key:
|
334
332
|
specification_version: 4
|
335
333
|
summary: Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/i386-mingw32/libpq.dll
DELETED
Binary file
|