pg 0.12.1 → 0.12.2

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.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,7 +1,48 @@
1
+ 2012-01-03 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * History.rdoc:
4
+ Updating history for Lars's patch
5
+ [5daf0ca646d2] [tip]
6
+
7
+ * spec/m17n_spec.rb, spec/pgconn_spec.rb, spec/pgresult_spec.rb:
8
+ Moved all the spec hooks to the top of the file
9
+ [42671e5d4d67]
10
+
11
+ 2012-01-03 Michael Granger <ged@faeriemud.org>
12
+
13
+ * Merged in larskanis/ruby-pg (pull request #4)
14
+ [8d88c47ccc9b]
15
+
16
+ 2012-01-03 Lars Kanis <kanis@comcard.de>
17
+
18
+ * ext/extconf.rb, ext/pg.h:
19
+ Alternatively include 'st.h' instead of 'ruby/st.h'. This fixes
20
+ compilation on Ruby 1.8.
21
+ [0cf272cb383f]
22
+
23
+ 2012-01-03 Michael Granger <ged@FaerieMUD.org>
24
+
25
+ * Merged with 6fc514ea2547
26
+ [5ec3792d1cac]
27
+
28
+ 2012-01-02 Michael Granger <ged@FaerieMUD.org>
29
+
30
+ * .hgtags:
31
+ Added tag v0.12.1 for changeset 21f84883e5c2
32
+ [6fc514ea2547]
33
+
34
+ * .hgsigs:
35
+ Added signature for changeset f72b14d349bf
36
+ [21f84883e5c2] [v0.12.1]
37
+
1
38
  2011-12-27 Michael Granger <ged@FaerieMUD.org>
2
39
 
40
+ * History.rdoc:
41
+ Updating history file with the st.h change
42
+ [935f29411410]
43
+
3
44
  * Merged with f8d66e32b9a8
4
- [f72b14d349bf] [tip]
45
+ [f72b14d349bf] [github/master]
5
46
 
6
47
  2011-12-14 Michael Granger <ged@FaerieMUD.org>
7
48
 
@@ -1,8 +1,17 @@
1
+ == v0.12.2 [2012-01-03] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Fix for the 1.8.7 breakage introduced by the st.h fix for alternative Ruby
4
+ implementations (#97 and #98). Thanks to Lars Kanis for the patch.
5
+ - Encode error messages with the connection's encoding under 1.9 (#96)
6
+
7
+
1
8
  == v0.12.1 [2011-12-14] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  - Made rake-compiler a dev dependency, as Rubygems doesn't use the Rakefile
4
11
  for compiling the extension. Thanks to eolamey@bitbucket and Jeremy Evans
5
12
  for pointing this out.
13
+ - Added an explicit include for ruby/st.h for implementations that need it
14
+ (fixes #95).
6
15
 
7
16
 
8
17
  == v0.12.0 [2011-12-07] Michael Granger <ged@FaerieMUD.org>
@@ -61,7 +61,7 @@ $defs.push( "-DHAVE_ST_NOTIFY_EXTRA" ) if
61
61
 
62
62
  # unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
63
63
  have_header 'unistd.h' unless enable_config("static-build")
64
- have_header 'ruby/st.h' or abort "pg currently requires the ruby/st.h header"
64
+ have_header 'ruby/st.h' or have_header 'st.h' or abort "pg currently requires the ruby/st.h header"
65
65
 
66
66
  create_header()
67
67
  create_makefile( "pg_ext" )
data/ext/pg.c CHANGED
@@ -9,7 +9,7 @@
9
9
  modified at: Wed Jan 20 16:41:51 1999
10
10
 
11
11
  $Author: ged $
12
- $Date: 2011/12/14 20:20:25 $
12
+ $Date: 2012/01/03 23:14:35 $
13
13
  ************************************************/
14
14
 
15
15
  #include "pg.h"
@@ -28,7 +28,7 @@ static VALUE rb_cPGconn;
28
28
  static VALUE rb_cPGresult;
29
29
  static VALUE rb_ePGError;
30
30
 
31
- static const char *VERSION = "0.12.1";
31
+ static const char *VERSION = "0.12.2";
32
32
 
33
33
 
34
34
  /* The following functions are part of libpq, but not
@@ -134,14 +134,17 @@ new_pgresult(PGresult *result)
134
134
  static void
135
135
  pgresult_check(VALUE rb_pgconn, VALUE rb_pgresult)
136
136
  {
137
- VALUE error;
137
+ VALUE error, exception;
138
138
  PGconn *conn = get_pgconn(rb_pgconn);
139
139
  PGresult *result;
140
140
  Data_Get_Struct(rb_pgresult, PGresult, result);
141
+ #ifdef M17N_SUPPORTED
142
+ rb_encoding *enc = pgconn_get_client_encoding_as_rb_encoding(conn);
143
+ #endif
141
144
 
142
145
  if(result == NULL)
143
146
  {
144
- error = rb_exc_new2(rb_ePGError, PQerrorMessage(conn));
147
+ error = rb_str_new2( PQerrorMessage(conn) );
145
148
  }
146
149
  else
147
150
  {
@@ -156,17 +159,21 @@ pgresult_check(VALUE rb_pgconn, VALUE rb_pgresult)
156
159
  case PGRES_BAD_RESPONSE:
157
160
  case PGRES_FATAL_ERROR:
158
161
  case PGRES_NONFATAL_ERROR:
159
- error = rb_exc_new2(rb_ePGError, PQresultErrorMessage(result));
162
+ error = rb_str_new2( PQresultErrorMessage(result) );
160
163
  break;
161
164
  default:
162
- error = rb_exc_new2(rb_ePGError,
163
- "internal error : unknown result status.");
165
+ error = rb_str_new2( "internal error : unknown result status." );
164
166
  }
165
167
  }
166
168
 
167
- rb_iv_set(error, "@connection", rb_pgconn);
168
- rb_iv_set(error, "@result", rb_pgresult);
169
- rb_exc_raise(error);
169
+ #ifdef M17N_SUPPORTED
170
+ rb_enc_set_index( error, rb_enc_to_index(enc) );
171
+ #endif
172
+ exception = rb_exc_new3( rb_ePGError, error );
173
+ rb_iv_set( exception, "@connection", rb_pgconn );
174
+ rb_iv_set( exception, "@result", rb_pgresult );
175
+ rb_exc_raise( exception );
176
+
170
177
  return;
171
178
  }
172
179
 
data/ext/pg.h CHANGED
@@ -14,7 +14,11 @@
14
14
  #endif /* HAVE_UNISTD_H */
15
15
 
16
16
  #include "ruby.h"
17
- #include "ruby/st.h"
17
+ #ifdef HAVE_RUBY_ST_H
18
+ #include "ruby/st.h"
19
+ #elif HAVE_ST_H
20
+ #include "st.h"
21
+ #endif
18
22
  #include "libpq-fe.h"
19
23
  #include "libpq/libpq-fs.h" /* large-object interface */
20
24
  #include "compat.h"
@@ -26,6 +26,18 @@ describe "multinationalization support", :ruby_19 => true do
26
26
  @conn.exec( 'BEGIN' )
27
27
  end
28
28
 
29
+ after( :each ) do
30
+ @conn.exec( 'ROLLBACK' ) if @conn
31
+ end
32
+
33
+ after( :all ) do
34
+ teardown_testing_db( @conn ) if @conn
35
+ end
36
+
37
+
38
+ #
39
+ # Examples
40
+ #
29
41
 
30
42
  it "should return the same bytes in text format that are sent as inline text" do
31
43
  binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
@@ -115,6 +127,7 @@ describe "multinationalization support", :ruby_19 => true do
115
127
  end
116
128
  end
117
129
 
130
+
118
131
  describe "Ruby 1.9.x default_internal encoding" do
119
132
 
120
133
  it "honors the Encoding.default_internal if it's set and the synchronous interface is used" do
@@ -141,11 +154,17 @@ describe "multinationalization support", :ruby_19 => true do
141
154
  end
142
155
 
143
156
 
144
- after( :each ) do
145
- @conn.exec( 'ROLLBACK' ) if @conn
146
- end
157
+ it "encodes exception messages with the connection's encoding (#96)" do
158
+ @conn.set_client_encoding( 'utf-8' )
159
+ @conn.exec "CREATE TABLE foo (bar TEXT)"
147
160
 
148
- after( :all ) do
149
- teardown_testing_db( @conn ) if @conn
161
+ begin
162
+ @conn.exec "INSERT INTO foo VALUES ('Côte d'Ivoire')"
163
+ rescue => err
164
+ err.message.encoding.should == Encoding::UTF_8
165
+ else
166
+ fail "No exception raised?!"
167
+ end
150
168
  end
169
+
151
170
  end
@@ -22,6 +22,7 @@ require 'timeout'
22
22
  describe PGconn do
23
23
  include PgTestingHelpers
24
24
 
25
+
25
26
  before( :all ) do
26
27
  @conn = setup_testing_db( "PGconn" )
27
28
  end
@@ -30,6 +31,19 @@ describe PGconn do
30
31
  @conn.exec( 'BEGIN' )
31
32
  end
32
33
 
34
+ after( :each ) do
35
+ @conn.exec( 'ROLLBACK' )
36
+ end
37
+
38
+ after( :all ) do
39
+ teardown_testing_db( @conn )
40
+ end
41
+
42
+
43
+ #
44
+ # Examples
45
+ #
46
+
33
47
  it "can create a connection option string from a Hash of options" do
34
48
  optstring = PGconn.parse_connect_args(
35
49
  :host => 'pgsql.example.com',
@@ -633,11 +647,4 @@ describe PGconn do
633
647
  result.should == { 'one' => '47' }
634
648
  end
635
649
 
636
- after( :each ) do
637
- @conn.exec( 'ROLLBACK' )
638
- end
639
-
640
- after( :all ) do
641
- teardown_testing_db( @conn )
642
- end
643
650
  end
@@ -29,6 +29,18 @@ describe PGresult do
29
29
  @conn.exec( 'BEGIN' )
30
30
  end
31
31
 
32
+ after( :each ) do
33
+ @conn.exec( 'ROLLBACK' )
34
+ end
35
+
36
+ after( :all ) do
37
+ teardown_testing_db( @conn )
38
+ end
39
+
40
+
41
+ #
42
+ # Examples
43
+ #
32
44
 
33
45
  it "should act as an array of hashes" do
34
46
  res = @conn.exec("SELECT 1 AS a, 2 AS b")
@@ -240,11 +252,4 @@ describe PGresult do
240
252
  res.ftablecol(1).should == 0 # and it shouldn't raise an exception, either
241
253
  end
242
254
 
243
- after( :each ) do
244
- @conn.exec( 'ROLLBACK' )
245
- end
246
-
247
- after( :all ) do
248
- teardown_testing_db( @conn )
249
- end
250
255
  end
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.12.1
4
+ version: 0.12.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -49,11 +49,11 @@ cert_chain:
49
49
  -----END CERTIFICATE-----
50
50
 
51
51
  '
52
- date: 2012-01-02 00:00:00.000000000 Z
52
+ date: 2012-01-03 00:00:00.000000000 Z
53
53
  dependencies:
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: hoe-mercurial
56
- requirement: &70247769972340 !ruby/object:Gem::Requirement
56
+ requirement: &70233760093620 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
59
  - - ~>
@@ -61,10 +61,10 @@ dependencies:
61
61
  version: 1.3.1
62
62
  type: :development
63
63
  prerelease: false
64
- version_requirements: *70247769972340
64
+ version_requirements: *70233760093620
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: hoe-highline
67
- requirement: &70247769971300 !ruby/object:Gem::Requirement
67
+ requirement: &70233760093100 !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
70
70
  - - ~>
@@ -72,10 +72,10 @@ dependencies:
72
72
  version: 0.0.1
73
73
  type: :development
74
74
  prerelease: false
75
- version_requirements: *70247769971300
75
+ version_requirements: *70233760093100
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rake-compiler
78
- requirement: &70247769970780 !ruby/object:Gem::Requirement
78
+ requirement: &70233760092580 !ruby/object:Gem::Requirement
79
79
  none: false
80
80
  requirements:
81
81
  - - ~>
@@ -83,10 +83,10 @@ dependencies:
83
83
  version: '0.7'
84
84
  type: :development
85
85
  prerelease: false
86
- version_requirements: *70247769970780
86
+ version_requirements: *70233760092580
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: rspec
89
- requirement: &70247769970320 !ruby/object:Gem::Requirement
89
+ requirement: &70233760092140 !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
92
92
  - - ~>
@@ -94,10 +94,10 @@ dependencies:
94
94
  version: '2.6'
95
95
  type: :development
96
96
  prerelease: false
97
- version_requirements: *70247769970320
97
+ version_requirements: *70233760092140
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: hoe
100
- requirement: &70247769969900 !ruby/object:Gem::Requirement
100
+ requirement: &70233760091700 !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
103
103
  - - ~>
@@ -105,10 +105,10 @@ dependencies:
105
105
  version: '2.12'
106
106
  type: :development
107
107
  prerelease: false
108
- version_requirements: *70247769969900
108
+ version_requirements: *70233760091700
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: rdoc
111
- requirement: &70247770191220 !ruby/object:Gem::Requirement
111
+ requirement: &70233760164380 !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements:
114
114
  - - ~>
@@ -116,7 +116,7 @@ dependencies:
116
116
  version: '3.10'
117
117
  type: :development
118
118
  prerelease: false
119
- version_requirements: *70247770191220
119
+ version_requirements: *70233760164380
120
120
  description: ! "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].\n\nIt
121
121
  works with PostgreSQL 8.2 and later.\n\nThis will be the last minor version to support
122
122
  8.2 -- 0.13 will support 8.3 \nand later, following the \n{PostgreSQL Release Support
metadata.gz.sig CHANGED
Binary file