pg 0.14.1-x86-mingw32 → 0.15.0.pre.432-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,13 @@ describe PG::Result do
44
44
  res[0]['b'].should== '2'
45
45
  end
46
46
 
47
+ it "should yield a row as an array" do
48
+ res = @conn.exec("SELECT 1 AS a, 2 AS b")
49
+ list = []
50
+ res.each_row { |r| list << r }
51
+ list.should eq [['1', '2']]
52
+ end
53
+
47
54
  it "should insert nil AS NULL and return NULL as nil" do
48
55
  res = @conn.exec("SELECT $1::int AS n", [nil])
49
56
  res[0]['n'].should be_nil()
@@ -66,13 +73,14 @@ describe PG::Result do
66
73
  should == 'relation "nonexistant_table" does not exist'
67
74
  result.error_field( PG::PG_DIAG_MESSAGE_DETAIL ).should be_nil()
68
75
  result.error_field( PG::PG_DIAG_MESSAGE_HINT ).should be_nil()
69
- result.error_field( PG::PG_DIAG_STATEMENT_POSITION ).should == '15'
76
+ statement_pos = RSpec.configuration.exclusion_filter[:postgresql_90] ? nil : '15'
77
+ result.error_field( PG::PG_DIAG_STATEMENT_POSITION ).should == statement_pos
70
78
  result.error_field( PG::PG_DIAG_INTERNAL_POSITION ).should be_nil()
71
79
  result.error_field( PG::PG_DIAG_INTERNAL_QUERY ).should be_nil()
72
80
  result.error_field( PG::PG_DIAG_CONTEXT ).should be_nil()
73
- result.error_field( PG::PG_DIAG_SOURCE_FILE ).should =~ /parse_relation\.c$/
74
- result.error_field( PG::PG_DIAG_SOURCE_LINE ).should == '857'
75
- result.error_field( PG::PG_DIAG_SOURCE_FUNCTION ).should == 'parserOpenTable'
81
+ result.error_field( PG::PG_DIAG_SOURCE_FILE ).should =~ /parse_relation\.c$|namespace\.c$/
82
+ result.error_field( PG::PG_DIAG_SOURCE_LINE ).should =~ /^\d+$/
83
+ result.error_field( PG::PG_DIAG_SOURCE_FUNCTION ).should =~ /^parserOpenTable$|^RangeVarGetRelid$/
76
84
 
77
85
  end
78
86
 
@@ -89,7 +97,7 @@ describe PG::Result do
89
97
  it "should return the same bytes in binary format that are sent in binary format" do
90
98
  binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
91
99
  bytes = File.open(binary_file, 'rb').read
92
- res = @conn.exec('VALUES ($1::bytea)',
100
+ res = @conn.exec('VALUES ($1::bytea)',
93
101
  [ { :value => bytes, :format => 1 } ], 1)
94
102
  res[0]['column1'].should== bytes
95
103
  res.getvalue(0,0).should == bytes
@@ -111,7 +119,7 @@ describe PG::Result do
111
119
  it "should return the same bytes in text format that are sent in binary format" do
112
120
  binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
113
121
  bytes = File.open(binary_file, 'rb').read
114
- res = @conn.exec('VALUES ($1::bytea)',
122
+ res = @conn.exec('VALUES ($1::bytea)',
115
123
  [ { :value => bytes, :format => 1 } ])
116
124
  PG::Connection.unescape_bytea(res[0]['column1']).should== bytes
117
125
  end
@@ -127,8 +135,8 @@ describe PG::Result do
127
135
  out_bytes.should == in_bytes
128
136
  end
129
137
 
130
- it "should return the parameter type of the specified prepared statement parameter" do
131
- query = 'SELECT * FROM pg_stat_activity WHERE user = $1::name AND current_query = $2::text'
138
+ it "should return the parameter type of the specified prepared statement parameter", :postgresql_92 do
139
+ query = 'SELECT * FROM pg_stat_activity WHERE user = $1::name AND query = $2::text'
132
140
  @conn.prepare( 'queryfinder', query )
133
141
  res = @conn.describe_prepared( 'queryfinder' )
134
142
 
@@ -260,4 +268,11 @@ describe PG::Result do
260
268
  }.to raise_error( PG::Error, /relation "nonexistant_table" does not exist/ )
261
269
  end
262
270
 
271
+ it "can return the values of a single field" do
272
+ res = @conn.exec( "SELECT 1 AS x, 'a' AS y UNION ALL SELECT 2, 'b'" )
273
+ res.field_values( 'x' ).should == ['1', '2']
274
+ res.field_values( 'y' ).should == ['a', 'b']
275
+ expect{ res.field_values( '' ) }.to raise_error(IndexError)
276
+ expect{ res.field_values( :x ) }.to raise_error(TypeError)
277
+ end
263
278
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
5
- prerelease:
4
+ hash: 2307602505
5
+ prerelease: 7
6
6
  segments:
7
7
  - 0
8
- - 14
9
- - 1
10
- version: 0.14.1
8
+ - 15
9
+ - 0
10
+ - pre
11
+ - 432
12
+ version: 0.15.0.pre.432
11
13
  platform: x86-mingw32
12
14
  authors:
13
15
  - Michael Granger
@@ -15,10 +17,9 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-09-04 00:00:00 Z
20
+ date: 2013-02-04 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
- name: hoe-mercurial
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
@@ -32,11 +33,27 @@ dependencies:
32
33
  - 0
33
34
  version: 1.4.0
34
35
  type: :development
36
+ name: hoe-mercurial
35
37
  version_requirements: *id001
36
38
  - !ruby/object:Gem::Dependency
37
- name: rdoc
38
39
  prerelease: false
39
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 0
48
+ - 1
49
+ - 0
50
+ version: 0.1.0
51
+ type: :development
52
+ name: hoe-highline
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
40
57
  none: false
41
58
  requirements:
42
59
  - - ~>
@@ -47,11 +64,11 @@ dependencies:
47
64
  - 10
48
65
  version: "3.10"
49
66
  type: :development
50
- version_requirements: *id002
67
+ name: rdoc
68
+ version_requirements: *id003
51
69
  - !ruby/object:Gem::Dependency
52
- name: rake-compiler
53
70
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
55
72
  none: false
56
73
  requirements:
57
74
  - - ~>
@@ -62,11 +79,11 @@ dependencies:
62
79
  - 7
63
80
  version: "0.7"
64
81
  type: :development
65
- version_requirements: *id003
82
+ name: rake-compiler
83
+ version_requirements: *id004
66
84
  - !ruby/object:Gem::Dependency
67
- name: hoe-deveiate
68
85
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
70
87
  none: false
71
88
  requirements:
72
89
  - - ~>
@@ -77,22 +94,23 @@ dependencies:
77
94
  - 1
78
95
  version: "0.1"
79
96
  type: :development
80
- version_requirements: *id004
97
+ name: hoe-deveiate
98
+ version_requirements: *id005
81
99
  - !ruby/object:Gem::Dependency
82
- name: hoe
83
100
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
101
+ requirement: &id006 !ruby/object:Gem::Requirement
85
102
  none: false
86
103
  requirements:
87
104
  - - ~>
88
105
  - !ruby/object:Gem::Version
89
- hash: 7
106
+ hash: 15
90
107
  segments:
91
108
  - 3
92
- - 0
93
- version: "3.0"
109
+ - 4
110
+ version: "3.4"
94
111
  type: :development
95
- version_requirements: *id005
112
+ name: hoe
113
+ version_requirements: *id006
96
114
  description: |-
97
115
  Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
98
116
 
@@ -101,14 +119,14 @@ description: |-
101
119
  A small example usage:
102
120
 
103
121
  #!/usr/bin/env ruby
104
-
122
+
105
123
  require 'pg'
106
-
124
+
107
125
  # Output a table of current connections to the DB
108
126
  conn = PG.connect( dbname: 'sales' )
109
127
  conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
110
128
  puts " PID | User | Query"
111
- result.each do |row|
129
+ result.each do |row|
112
130
  puts " %7d | %-16s | %s " %
113
131
  row.values_at('procpid', 'usename', 'current_query')
114
132
  end
@@ -129,8 +147,9 @@ extra_rdoc_files:
129
147
  - README.rdoc
130
148
  - POSTGRES
131
149
  - LICENSE
132
- - ext/pg_connection.c
150
+ - ext/gvl_wrappers.c
133
151
  - ext/pg.c
152
+ - ext/pg_connection.c
134
153
  - ext/pg_result.c
135
154
  files:
136
155
  - .gemtest
@@ -148,6 +167,8 @@ files:
148
167
  - Rakefile
149
168
  - Rakefile.cross
150
169
  - ext/extconf.rb
170
+ - ext/gvl_wrappers.c
171
+ - ext/gvl_wrappers.h
151
172
  - ext/pg.c
152
173
  - ext/pg.h
153
174
  - ext/pg_connection.c
@@ -160,6 +181,7 @@ files:
160
181
  - lib/pg/constants.rb
161
182
  - lib/pg/exceptions.rb
162
183
  - lib/pg/result.rb
184
+ - sample/array_insert.rb
163
185
  - sample/async_api.rb
164
186
  - sample/async_copyto.rb
165
187
  - sample/async_mixed.rb
@@ -214,16 +236,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
236
  required_rubygems_version: !ruby/object:Gem::Requirement
215
237
  none: false
216
238
  requirements:
217
- - - ">="
239
+ - - ">"
218
240
  - !ruby/object:Gem::Version
219
- hash: 3
241
+ hash: 25
220
242
  segments:
221
- - 0
222
- version: "0"
243
+ - 1
244
+ - 3
245
+ - 1
246
+ version: 1.3.1
223
247
  requirements: []
224
248
 
225
249
  rubyforge_project: pg
226
- rubygems_version: 1.8.17
250
+ rubygems_version: 1.8.24
227
251
  signing_key:
228
252
  specification_version: 3
229
253
  summary: Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]
metadata.gz.sig ADDED
Binary file