pg 0.15.1-x64-mingw32 → 0.16.0-x64-mingw32
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +395 -1
- data/History.rdoc +30 -3
- data/Manifest.txt +4 -0
- data/Rakefile +30 -10
- data/ext/errorcodes.def +931 -0
- data/ext/errorcodes.rb +45 -0
- data/ext/errorcodes.txt +463 -0
- data/ext/extconf.rb +11 -5
- data/ext/gvl_wrappers.c +6 -0
- data/ext/gvl_wrappers.h +47 -21
- data/ext/pg.c +29 -9
- data/ext/pg.h +30 -0
- data/ext/pg_connection.c +104 -44
- data/ext/pg_errors.c +89 -0
- data/ext/pg_result.c +48 -67
- data/lib/2.0/pg_ext.so +0 -0
- data/lib/pg.rb +1 -1
- data/spec/lib/helpers.rb +11 -2
- data/spec/pg/connection_spec.rb +113 -8
- data/spec/pg/result_spec.rb +69 -2
- data/spec/pg_spec.rb +13 -0
- metadata +16 -56
- metadata.gz.sig +0 -0
data/spec/pg/result_spec.rb
CHANGED
@@ -73,15 +73,30 @@ describe PG::Result do
|
|
73
73
|
should == 'relation "nonexistant_table" does not exist'
|
74
74
|
result.error_field( PG::PG_DIAG_MESSAGE_DETAIL ).should be_nil()
|
75
75
|
result.error_field( PG::PG_DIAG_MESSAGE_HINT ).should be_nil()
|
76
|
-
|
77
|
-
result.error_field( PG::PG_DIAG_STATEMENT_POSITION ).should == statement_pos
|
76
|
+
result.error_field( PG::PG_DIAG_STATEMENT_POSITION ).should == '15'
|
78
77
|
result.error_field( PG::PG_DIAG_INTERNAL_POSITION ).should be_nil()
|
79
78
|
result.error_field( PG::PG_DIAG_INTERNAL_QUERY ).should be_nil()
|
80
79
|
result.error_field( PG::PG_DIAG_CONTEXT ).should be_nil()
|
81
80
|
result.error_field( PG::PG_DIAG_SOURCE_FILE ).should =~ /parse_relation\.c$|namespace\.c$/
|
82
81
|
result.error_field( PG::PG_DIAG_SOURCE_LINE ).should =~ /^\d+$/
|
83
82
|
result.error_field( PG::PG_DIAG_SOURCE_FUNCTION ).should =~ /^parserOpenTable$|^RangeVarGetRelid$/
|
83
|
+
end
|
84
84
|
|
85
|
+
it "encapsulates database object names for integrity constraint violations", :postgresql_93 do
|
86
|
+
@conn.exec( "CREATE TABLE integrity (id SERIAL PRIMARY KEY)" )
|
87
|
+
exception = nil
|
88
|
+
begin
|
89
|
+
@conn.exec( "INSERT INTO integrity VALUES (NULL)" )
|
90
|
+
rescue PGError => err
|
91
|
+
exception = err
|
92
|
+
end
|
93
|
+
result = exception.result
|
94
|
+
|
95
|
+
result.error_field( PG::PG_DIAG_SCHEMA_NAME ).should == 'public'
|
96
|
+
result.error_field( PG::PG_DIAG_TABLE_NAME ).should == 'integrity'
|
97
|
+
result.error_field( PG::PG_DIAG_COLUMN_NAME ).should == 'id'
|
98
|
+
result.error_field( PG::PG_DIAG_DATATYPE_NAME ).should be_nil
|
99
|
+
result.error_field( PG::PG_DIAG_CONSTRAINT_NAME ).should be_nil
|
85
100
|
end
|
86
101
|
|
87
102
|
it "should detect division by zero as SQLSTATE 22012" do
|
@@ -275,4 +290,56 @@ describe PG::Result do
|
|
275
290
|
expect{ res.field_values( '' ) }.to raise_error(IndexError)
|
276
291
|
expect{ res.field_values( :x ) }.to raise_error(TypeError)
|
277
292
|
end
|
293
|
+
|
294
|
+
it "should raise a proper exception for a nonexistant table" do
|
295
|
+
expect {
|
296
|
+
@conn.exec( "SELECT * FROM nonexistant_table" )
|
297
|
+
}.to raise_error( PG::UndefinedTable, /relation "nonexistant_table" does not exist/ )
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should raise a more generic exception for an unknown SQLSTATE" do
|
301
|
+
old_error = PG::ERROR_CLASSES.delete('42P01')
|
302
|
+
begin
|
303
|
+
expect {
|
304
|
+
@conn.exec( "SELECT * FROM nonexistant_table" )
|
305
|
+
}.to raise_error{|error|
|
306
|
+
error.should be_an_instance_of(PG::SyntaxErrorOrAccessRuleViolation)
|
307
|
+
error.to_s.should match(/relation "nonexistant_table" does not exist/)
|
308
|
+
}
|
309
|
+
ensure
|
310
|
+
PG::ERROR_CLASSES['42P01'] = old_error
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
it "should raise a ServerError for an unknown SQLSTATE class" do
|
315
|
+
old_error1 = PG::ERROR_CLASSES.delete('42P01')
|
316
|
+
old_error2 = PG::ERROR_CLASSES.delete('42')
|
317
|
+
begin
|
318
|
+
expect {
|
319
|
+
@conn.exec( "SELECT * FROM nonexistant_table" )
|
320
|
+
}.to raise_error{|error|
|
321
|
+
error.should be_an_instance_of(PG::ServerError)
|
322
|
+
error.to_s.should match(/relation "nonexistant_table" does not exist/)
|
323
|
+
}
|
324
|
+
ensure
|
325
|
+
PG::ERROR_CLASSES['42P01'] = old_error1
|
326
|
+
PG::ERROR_CLASSES['42'] = old_error2
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should raise a proper exception for a nonexistant schema" do
|
331
|
+
expect {
|
332
|
+
@conn.exec( "DROP SCHEMA nonexistant_schema" )
|
333
|
+
}.to raise_error( PG::InvalidSchemaName, /schema "nonexistant_schema" does not exist/ )
|
334
|
+
end
|
335
|
+
|
336
|
+
it "the raised result should be nil in case of a connection error" do
|
337
|
+
c = PGconn.connect_start( '127.0.0.1', 54320, "", "", "me", "xxxx", "somedb" )
|
338
|
+
expect {
|
339
|
+
c.exec "select 1"
|
340
|
+
}.to raise_error{|error|
|
341
|
+
error.should be_an_instance_of(PG::UnableToSend)
|
342
|
+
error.result.should == nil
|
343
|
+
}
|
344
|
+
end
|
278
345
|
end
|
data/spec/pg_spec.rb
CHANGED
@@ -27,5 +27,18 @@ describe PG do
|
|
27
27
|
PG.should be_threadsafe()
|
28
28
|
end
|
29
29
|
|
30
|
+
it "does have hierarchical error classes" do
|
31
|
+
PG::UndefinedTable.ancestors[0,4].should == [
|
32
|
+
PG::UndefinedTable,
|
33
|
+
PG::SyntaxErrorOrAccessRuleViolation,
|
34
|
+
PG::ServerError,
|
35
|
+
PG::Error]
|
36
|
+
|
37
|
+
PG::InvalidSchemaName.ancestors[0,3].should == [
|
38
|
+
PG::InvalidSchemaName,
|
39
|
+
PG::ServerError,
|
40
|
+
PG::Error]
|
41
|
+
end
|
42
|
+
|
30
43
|
end
|
31
44
|
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 15
|
9
|
-
- 1
|
10
|
-
version: 0.15.1
|
4
|
+
version: 0.16.0
|
11
5
|
platform: x64-mingw32
|
12
6
|
authors:
|
13
7
|
- Michael Granger
|
@@ -36,21 +30,15 @@ cert_chain:
|
|
36
30
|
mMFp4kPUHbWOqCp2mz9gCA==
|
37
31
|
-----END CERTIFICATE-----
|
38
32
|
|
39
|
-
date: 2013-
|
33
|
+
date: 2013-07-23 00:00:00 Z
|
40
34
|
dependencies:
|
41
35
|
- !ruby/object:Gem::Dependency
|
42
36
|
name: hoe-mercurial
|
43
37
|
prerelease: false
|
44
38
|
requirement: &id001 !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
39
|
requirements:
|
47
40
|
- - ~>
|
48
41
|
- !ruby/object:Gem::Version
|
49
|
-
hash: 7
|
50
|
-
segments:
|
51
|
-
- 1
|
52
|
-
- 4
|
53
|
-
- 0
|
54
42
|
version: 1.4.0
|
55
43
|
type: :development
|
56
44
|
version_requirements: *id001
|
@@ -58,15 +46,9 @@ dependencies:
|
|
58
46
|
name: hoe-highline
|
59
47
|
prerelease: false
|
60
48
|
requirement: &id002 !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
49
|
requirements:
|
63
50
|
- - ~>
|
64
51
|
- !ruby/object:Gem::Version
|
65
|
-
hash: 27
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
- 1
|
69
|
-
- 0
|
70
52
|
version: 0.1.0
|
71
53
|
type: :development
|
72
54
|
version_requirements: *id002
|
@@ -74,29 +56,19 @@ dependencies:
|
|
74
56
|
name: rdoc
|
75
57
|
prerelease: false
|
76
58
|
requirement: &id003 !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
59
|
requirements:
|
79
60
|
- - ~>
|
80
61
|
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
segments:
|
83
|
-
- 3
|
84
|
-
- 10
|
85
|
-
version: "3.10"
|
62
|
+
version: "4.0"
|
86
63
|
type: :development
|
87
64
|
version_requirements: *id003
|
88
65
|
- !ruby/object:Gem::Dependency
|
89
66
|
name: rake-compiler
|
90
67
|
prerelease: false
|
91
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
69
|
requirements:
|
94
70
|
- - ~>
|
95
71
|
- !ruby/object:Gem::Version
|
96
|
-
hash: 27
|
97
|
-
segments:
|
98
|
-
- 0
|
99
|
-
- 8
|
100
72
|
version: "0.8"
|
101
73
|
type: :development
|
102
74
|
version_requirements: *id004
|
@@ -104,14 +76,9 @@ dependencies:
|
|
104
76
|
name: hoe-deveiate
|
105
77
|
prerelease: false
|
106
78
|
requirement: &id005 !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
79
|
requirements:
|
109
80
|
- - ~>
|
110
81
|
- !ruby/object:Gem::Version
|
111
|
-
hash: 15
|
112
|
-
segments:
|
113
|
-
- 0
|
114
|
-
- 2
|
115
82
|
version: "0.2"
|
116
83
|
type: :development
|
117
84
|
version_requirements: *id005
|
@@ -119,15 +86,10 @@ dependencies:
|
|
119
86
|
name: hoe
|
120
87
|
prerelease: false
|
121
88
|
requirement: &id006 !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
89
|
requirements:
|
124
90
|
- - ~>
|
125
91
|
- !ruby/object:Gem::Version
|
126
|
-
|
127
|
-
segments:
|
128
|
-
- 3
|
129
|
-
- 0
|
130
|
-
version: "3.0"
|
92
|
+
version: "3.6"
|
131
93
|
type: :development
|
132
94
|
version_requirements: *id006
|
133
95
|
description: |-
|
@@ -164,11 +126,13 @@ extra_rdoc_files:
|
|
164
126
|
- README-Windows.rdoc
|
165
127
|
- README.ja.rdoc
|
166
128
|
- README.rdoc
|
129
|
+
- ext/errorcodes.txt
|
167
130
|
- POSTGRES
|
168
131
|
- LICENSE
|
169
|
-
- ext/pg_connection.c
|
170
|
-
- ext/pg.c
|
171
132
|
- ext/gvl_wrappers.c
|
133
|
+
- ext/pg.c
|
134
|
+
- ext/pg_connection.c
|
135
|
+
- ext/pg_errors.c
|
172
136
|
- ext/pg_result.c
|
173
137
|
files:
|
174
138
|
- .gemtest
|
@@ -185,12 +149,16 @@ files:
|
|
185
149
|
- README.rdoc
|
186
150
|
- Rakefile
|
187
151
|
- Rakefile.cross
|
152
|
+
- ext/errorcodes.def
|
153
|
+
- ext/errorcodes.rb
|
154
|
+
- ext/errorcodes.txt
|
188
155
|
- ext/extconf.rb
|
189
156
|
- ext/gvl_wrappers.c
|
190
157
|
- ext/gvl_wrappers.h
|
191
158
|
- ext/pg.c
|
192
159
|
- ext/pg.h
|
193
160
|
- ext/pg_connection.c
|
161
|
+
- ext/pg_errors.c
|
194
162
|
- ext/pg_result.c
|
195
163
|
- ext/vc/pg.sln
|
196
164
|
- ext/vc/pg_18/pg.vcproj
|
@@ -230,6 +198,8 @@ licenses:
|
|
230
198
|
- BSD
|
231
199
|
- Ruby
|
232
200
|
- GPL
|
201
|
+
metadata: {}
|
202
|
+
|
233
203
|
post_install_message:
|
234
204
|
rdoc_options:
|
235
205
|
- -f
|
@@ -241,31 +211,21 @@ rdoc_options:
|
|
241
211
|
require_paths:
|
242
212
|
- lib
|
243
213
|
required_ruby_version: !ruby/object:Gem::Requirement
|
244
|
-
none: false
|
245
214
|
requirements:
|
246
215
|
- - ">="
|
247
216
|
- !ruby/object:Gem::Version
|
248
|
-
hash: 57
|
249
|
-
segments:
|
250
|
-
- 1
|
251
|
-
- 8
|
252
|
-
- 7
|
253
217
|
version: 1.8.7
|
254
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
|
-
none: false
|
256
219
|
requirements:
|
257
220
|
- - ">="
|
258
221
|
- !ruby/object:Gem::Version
|
259
|
-
hash: 3
|
260
|
-
segments:
|
261
|
-
- 0
|
262
222
|
version: "0"
|
263
223
|
requirements: []
|
264
224
|
|
265
225
|
rubyforge_project: pg
|
266
|
-
rubygems_version:
|
226
|
+
rubygems_version: 2.0.3
|
267
227
|
signing_key:
|
268
|
-
specification_version:
|
228
|
+
specification_version: 4
|
269
229
|
summary: Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]
|
270
230
|
test_files: []
|
271
231
|
|
metadata.gz.sig
CHANGED
Binary file
|