pg 0.18.2 → 0.18.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8807e5610f416a9fe9a4bcc597986c25a5c35b9
4
- data.tar.gz: a98032311306661db24f48a69d847a1896a277fb
3
+ metadata.gz: 71b5c038eee17a71788dfba8107b05e3e5abf97f
4
+ data.tar.gz: 4c4bc07dd354ab5dda95123a4c6ae8ba40ef77a0
5
5
  SHA512:
6
- metadata.gz: 882d2bda71c4946f3a0b72ffb8a8e31528411019dd531d472537c310f2e79c36e4bccd17280d359cf31f00e07b613b818ffb3e1f1d3df3c4a0d599c05d0d400e
7
- data.tar.gz: 76e9118ba0e1f7e0577c1f86d5bb0c0a509000df3b8bf0fd4b1e169e34050f3849267e41066c4cd3e2f1d4d221e4a089a5466bc131debfafb675ff22c87525e2
6
+ metadata.gz: da86cff37eeb015b02dad06bd877249d705bb54f64d8c4199254b369a5baa0617694124130e83fd850872bc88fc9845c06cfbfb64614987375421c86d88d0965
7
+ data.tar.gz: 468aa7dc975636161da5fe512a9a0efcdc3e95f9282dd20cf0e82de9854deaaac3150a32f531947904cc665763d795767c3332767dfe38d7b90a94d8faff01d9
Binary file
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,267 @@
1
+ 2015-09-03 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * History.rdoc:
4
+ Added recent fix to the History file
5
+ [f12dc2f1ce14] [tip]
6
+
7
+ 2015-09-01 Lars Kanis <lars@greiz-reinsdorf.de>
8
+
9
+ * lib/pg/text_decoder.rb:
10
+ Add missing require
11
+ [d0ba6a2cb10f]
12
+
13
+ * Merge pull request #9 from ramfjord/date-decoder-return-dates
14
+
15
+ Date decoder to return real Dates
16
+ [676def89b826]
17
+
18
+ 2015-06-21 Thomas Ramfjord <thomas.ramfjord@gmail.com>
19
+
20
+ * lib/pg/text_decoder.rb, spec/pg/basic_type_mapping_spec.rb:
21
+ modified TextDecoder::Date to return an actual ruby Date instead of
22
+ a Time
23
+ [c50593d12ba2]
24
+
25
+ 2015-08-20 Lars Kanis <lars@greiz-reinsdorf.de>
26
+
27
+ * Rakefile:
28
+ Add include for Hoe::MercurialHelpers as a temporary solution for
29
+ the error:
30
+
31
+ Packaging tasks require the hoe-mercurial plugin (gem install hoe-
32
+ mercurial)
33
+ [a84f83ff5b31]
34
+
35
+ * History.rdoc:
36
+ Update History.rdoc
37
+ [cadfac537e73]
38
+
39
+ * Merge branch 'master' of github.com:larskanis/ruby-pg
40
+ [d27d6d5a6545]
41
+
42
+ * README.rdoc:
43
+ Add Appveyor status badge to the README.
44
+ [c9637c6efcfb]
45
+
46
+ * appveyor.yml:
47
+ Use 9.3 because 9.0, 9.1 and 9.2 segfault in PG.init_openssl
48
+ [158f6649b7b8]
49
+
50
+ * spec/pg/connection_spec.rb:
51
+ Skip conn#host test on Windows-x64, because it segfaults, currently.
52
+ [04110aad7fc6]
53
+
54
+ * spec/pg/connection_spec.rb:
55
+ libpq on Windows doesn't respect the PGPORT env variable, so we
56
+ accept both.
57
+ [b4b666011f3f]
58
+
59
+ * spec/helpers.rb:
60
+ Older versions of PostgreSQL don't have a pid column, so this could
61
+ raise an exception: TypeError: can't convert nil into Integer
62
+ [48f1145fa631]
63
+
64
+ * Rakefile.cross:
65
+ Update OpenSSL version for Windows cross build.
66
+ [be6b75fef0ff]
67
+
68
+ * appveyor.yml:
69
+ Add CI-tests on appveyor.
70
+ [c2dc9e491853]
71
+
72
+ 2015-06-29 Lars Kanis <kanis@comcard.de>
73
+
74
+ * History.rdoc:
75
+ Merge branch 'master' of https://github.com/larskanis/ruby-pg
76
+
77
+ Conflicts: History.rdoc
78
+ [affb47533d82]
79
+
80
+ * History.rdoc, ext/util.c, spec/pg/type_spec.rb:
81
+ Fix data type resulting in wrong base64 encoding.
82
+ [5fb9170f6a7d]
83
+
84
+ 2015-06-17 Lars Kanis <lars@greiz-reinsdorf.de>
85
+
86
+ * Gemfile, Rakefile, Rakefile.cross:
87
+ Update versions of rake-compiler-dock, OpenSSL and PostgreSQL.
88
+ [10c6b496314c]
89
+
90
+ 2015-06-12 Lars Kanis <lars@greiz-reinsdorf.de>
91
+
92
+ * Rakefile.cross:
93
+ Update OpenSSL and PostgreSQL versions for cross build.
94
+ [02094cca1cf8]
95
+
96
+ 2015-06-11 Lars Kanis <lars@greiz-reinsdorf.de>
97
+
98
+ * History.rdoc, README-Windows.rdoc:
99
+ Update README-Windows in regards to rake-compiler-dock.
100
+ [4d9fd821ec1e]
101
+
102
+ 2015-06-09 Lars Kanis <kanis@comcard.de>
103
+
104
+ * Rakefile.cross:
105
+ Cross build: Ensure ChangeLog file is built on the host side before
106
+ entering the docker container.
107
+ [d32412acff38]
108
+
109
+ * Rakefile.cross:
110
+ Cross build: Add workaround for missing symlink support on Windows.
111
+ [52bb3eef00f0]
112
+
113
+ * Rakefile.cross:
114
+ Explicitly set the gcc-toolchain, instead of deriving from the rake-
115
+ compiler config.
116
+
117
+ Now, that we use the libpq.dll (instead of static linking), we can
118
+ mix the gcc-toolchains. So we better build the dll with the newer
119
+ mingw-w64 toolchain (instead of the old mingw32) and build only the
120
+ extension for ruby-1.9 with the old mingw32-gcc.
121
+ [b3d169fa189b]
122
+
123
+ * Merge https://github.com/ged/ruby-pg
124
+ [5aeb99dda0ca]
125
+
126
+ 2015-05-25 Michael Granger <ged@FaerieMUD.org>
127
+
128
+ * lib/pg/basic_type_mapping.rb:
129
+ Whitespace fixes
130
+ [57cfbc230597]
131
+
132
+ 2015-05-14 Michael Granger <ged@FaerieMUD.org>
133
+
134
+ * .hgtags:
135
+ Added tag v0.18.2 for changeset 22a361201fd1
136
+ [00d6997551e6]
137
+
138
+ * .hgsigs:
139
+ Added signature for changeset 7d31b04e7913
140
+ [d77ab8ab870e]
141
+
142
+ * History.rdoc, lib/pg.rb:
143
+ Bump patch version, update History
144
+ [fa56690fe72d]
145
+
146
+ * Merged with git branch.
147
+ [9b2c80df821d]
148
+
149
+ 2015-06-09 Lars Kanis <kanis@comcard.de>
150
+
151
+ * Rakefile.cross:
152
+ Cross build: Copy gem signing key and certs to be accessable from
153
+ the docker container
154
+ [c5382a785f4d]
155
+
156
+ 2015-06-08 Lars Kanis <lars@greiz-reinsdorf.de>
157
+
158
+ * Merged
159
+ [3d56a65c78c5]
160
+
161
+ * Gemfile, Rakefile, Rakefile.cross:
162
+ Add rake task 'gem:windows' which makes use of the new rake-
163
+ compiler-dock.
164
+
165
+ Also update the Gemfile per 'rake bundler:gemfile' .
166
+ [fafadd62cc6d]
167
+
168
+ * Rakefile.cross:
169
+ Cross build: Work around missing dependency to libcommon in
170
+ PostgreSQL-9.4.0
171
+ [630a22437026]
172
+
173
+ 2015-05-25 Michael Granger <ged@FaerieMUD.org>
174
+
175
+ * ext/pg_connection.c:
176
+ Change instance_of checks to kind_of for subclassing [#220]
177
+ [eb4d3c003bd6] [github/kind-of-fix]
178
+
179
+ * lib/pg/basic_type_mapping.rb:
180
+ Whitespace fixes
181
+ [4a4368e30bcf] [github/master]
182
+
183
+ 2015-05-14 Michael Granger <ged@FaerieMUD.org>
184
+
185
+ * .hgtags:
186
+ Added tag v0.18.2 for changeset 22a361201fd1
187
+ [94e26b472c78]
188
+
189
+ * .hgsigs:
190
+ Added signature for changeset 7d31b04e7913
191
+ [22a361201fd1] [v0.18.2]
192
+
193
+ * History.rdoc, lib/pg.rb:
194
+ Bump patch version, update History
195
+ [7d31b04e7913]
196
+
197
+ * Merged with git branch.
198
+ [45a1753da19a]
199
+
200
+ * .rvm.gems:
201
+ Bump the rvm gemset gem versions
202
+ [8050020330d8]
203
+
204
+ 2015-03-13 Lars Kanis <lars@greiz-reinsdorf.de>
205
+
206
+ * ext/pg_text_encoder.c, ext/util.c, ext/util.h:
207
+ Avoid possible symbol name clash when linking againt static libpq.
208
+
209
+ This should fix issue #209 .
210
+ [2334a1bc38e6]
211
+
212
+ 2015-02-11 Lars Kanis <lars@greiz-reinsdorf.de>
213
+
214
+ * ext/pg.c, spec/pg/connection_spec.rb:
215
+ Merge from git branch.
216
+ [a7261eb6796f]
217
+
218
+ * ext/pg.h, ext/pg_text_decoder.c:
219
+ Merge branch 'non-c99-compiler'
220
+ [7e8f1e4da59d]
221
+
222
+ 2015-02-06 Lars Kanis <lars@greiz-reinsdorf.de>
223
+
224
+ * ext/extconf.rb, ext/pg.h, ext/pg_result.c, ext/pg_text_decoder.c,
225
+ ext/pg_type_map_by_mri_type.c:
226
+ Use fixed size arrays in case the compiler doesn't support C99
227
+ variable length arrays.
228
+
229
+ This is notably the MSVC compiler.
230
+
231
+ Note: The MSVC build environment is currently not tested on a
232
+ regular base, so is not fully supported.
233
+ [a08290a78221]
234
+
235
+ 2015-02-11 Lars Kanis <lars@greiz-reinsdorf.de>
236
+
237
+ * ext/pg_connection.c:
238
+ Replace quote_ident implementation with that of
239
+ PG::TextEncoder::Identifier .
240
+
241
+ This allowes quoation of array of strings in addition to plain
242
+ strings and removes duplicated code.
243
+
244
+ It also removes the 63 byte limitation and therefore obsolets pull
245
+ request #21 https://bitbucket.org/ged/ruby-pg/pull-request/21
246
+ [b8ac29b020ee]
247
+
248
+ * ext/pg.c, ext/pg.h, ext/pg_text_decoder.c, ext/pg_text_encoder.c,
249
+ spec/pg/connection_spec.rb, spec/pg/type_spec.rb:
250
+ Derive PG::TextDecoder::Identifier from PG::SimpleDecoder instead of
251
+ CompositeDecoder
252
+
253
+ .. and equally for Encoder.
254
+
255
+ Identifiers are strings, so there is no good reason to compose it
256
+ from other element types. This change allows a faster quoting
257
+ implementation.
258
+ [55ec58cabad4]
259
+
1
260
  2015-05-14 Michael Granger <ged@FaerieMUD.org>
2
261
 
3
262
  * .rvmrc:
4
263
  Bump default rvm Ruby to 2.2
5
- [128b075d5800] [tip]
264
+ [128b075d5800]
6
265
 
7
266
  2015-03-13 Lars Kanis <lars@greiz-reinsdorf.de>
8
267
 
@@ -64,7 +323,7 @@
64
323
 
65
324
  * README.rdoc, ext/pg.c:
66
325
  Update copyright notices
67
- [447962e0dcba] [github/master]
326
+ [447962e0dcba]
68
327
 
69
328
  * spec/pg/connection_spec.rb:
70
329
  Whitespace fixes
@@ -1,3 +1,16 @@
1
+ == v0.18.3 [2015-09-03] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+ - Use rake-compiler-dock to build windows gems easily.
5
+ - Add CI-tests on appveyor and fix test cases accordingly.
6
+
7
+ Bugfixes:
8
+ - Fix data type resulting in wrong base64 encoding.
9
+ - Change instance_of checks to kind_of for subclassing. #220
10
+ - TextDecoder::Date returns an actual Ruby Date instead of a Time
11
+ (thanks to Thomas Ramfjord)
12
+
13
+
1
14
  == v0.18.2 [2015-05-14] Michael Granger <ged@FaerieMUD.org>
2
15
 
3
16
  Enhancements:
@@ -2,9 +2,9 @@
2
2
 
3
3
  In order to build this extension on MS Windows you will need a couple things.
4
4
 
5
- First, a compiler. For the one click installer this means you should either
6
- use VC++ 6.0 or the compiler that comes with cygwin or mingw if you're
7
- building on that platform.
5
+ First, a compiler. For the one click installer this means you should use
6
+ the DevKit or the compiler that comes with cygwin if you're building on that
7
+ platform.
8
8
 
9
9
  If you've built Ruby yourself, you should use the same compiler to build
10
10
  this library that you used to build Ruby.
@@ -29,34 +29,23 @@ Adjust your path accordingly. BE SURE TO USE THE SHORT PATH NAMES! If you
29
29
  try to use a path with spaces in it, the nmake.exe program will choke.
30
30
 
31
31
 
32
- == Cross compiling for mswin32
32
+ == Building binary 'pg' gems for MS Windows
33
33
 
34
- Using rake-compiler a cross compiled pg gem can be build on a Linux or MacOS X
35
- host for the win32 platform. The generated gem is statically linked against
36
- libpq and libssl. OpenSSL and PostgreSQL are downloaded and compiled from the
37
- sources. There are no runtime dependencies to any but the standard Windows
38
- DLLs.
34
+ Binary gems for windows can be built on Linux, OS-X and even on Windows
35
+ with the help of docker. This is how regular windows gems are built for
36
+ rubygems.org .
39
37
 
40
- Install mingw32 using the instructions in rake-compiler's README.
41
- For Debian/Ubuntu it is <tt>apt-get install gcc-mingw32</tt> .
42
- Use ruby-1.8.7 for the following commands.
38
+ To do this, install boot2docker [on Windows](https://github.com/boot2docker/windows-installer/releases)
39
+ or [on OS X](https://github.com/boot2docker/osx-installer/releases) and make
40
+ sure it is started. A native Docker installation is best on Linux.
43
41
 
44
- Download and cross compile ruby 1.8 and 1.9 for win32 with:
42
+ Then run:
45
43
 
46
- rake-compiler cross-ruby VERSION=1.8.7-p352
47
- rake-compiler cross-ruby VERSION=1.9.2-p290
44
+ rake gem:windows
48
45
 
49
- Download and cross compile pg for win32:
50
-
51
- rake cross native gem
52
-
53
- or with custom versions:
54
-
55
- rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2 \
56
- OPENSSL_VERSION=1.0.0e POSTGRESQL_VERSION=9.1.1
57
-
58
- If everything works, there should be pg-VERSION-x86-mingw32.gem in the pkg
59
- directory.
46
+ This will download a docker image suited for building windows gems, and it
47
+ will download and build OpenSSL and PostgreSQL. Finally the gem is built
48
+ containing binaries for all supported ruby versions.
60
49
 
61
50
 
62
51
  == Reporting Problems
@@ -29,7 +29,8 @@ A small example usage:
29
29
 
30
30
  == Build Status
31
31
 
32
- {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ged/ruby-pg]
32
+ {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status Travis-CI" />}[https://travis-ci.org/ged/ruby-pg]
33
+ {<img src="https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master]
33
34
 
34
35
 
35
36
  == Requirements
data/Rakefile CHANGED
@@ -61,6 +61,7 @@ $hoespec = Hoe.spec 'pg' do
61
61
  self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
62
62
 
63
63
  self.dependency 'rake-compiler', '~> 0.9', :developer
64
+ self.dependency 'rake-compiler-dock', '~> 0.3', :developer
64
65
  self.dependency 'hoe', '~> 3.12', :developer
65
66
  self.dependency 'hoe-deveiate', '~> 0.6', :developer
66
67
  self.dependency 'hoe-bundler', '~> 1.0', :developer
@@ -150,6 +151,7 @@ file 'ChangeLog' do |task|
150
151
  if File.exist?('.hg/branch')
151
152
  $stderr.puts "Updating the changelog..."
152
153
  begin
154
+ include Hoe::MercurialHelpers
153
155
  content = make_changelog()
154
156
  rescue NameError
155
157
  abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
@@ -21,17 +21,28 @@ end
21
21
  class CrossLibrary < OpenStruct
22
22
  include Rake::DSL
23
23
 
24
- def initialize(for_platform, openssl_config)
24
+ def initialize(for_platform, openssl_config, toolchain)
25
25
  super()
26
26
 
27
27
  self.for_platform = for_platform
28
28
  self.openssl_config = openssl_config
29
+ self.host_platform = toolchain
29
30
 
30
31
  # Cross-compilation constants
31
- self.openssl_version = ENV['OPENSSL_VERSION'] || '1.0.1i'
32
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.3.5'
33
-
34
- self.compile_home = Pathname( "./build" ).expand_path
32
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.0.2d'
33
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.4.4'
34
+
35
+ # Check if symlinks work in the current working directory.
36
+ # This fails, if rake-compiler-dock is running on a Windows box.
37
+ begin
38
+ FileUtils.rm_f '.test_symlink'
39
+ FileUtils.ln_s '/', '.test_symlink'
40
+ rescue SystemCallError
41
+ # Symlinks don't work -> use home directory instead
42
+ self.compile_home = Pathname( "~/.ruby-pg-build" ).expand_path
43
+ else
44
+ self.compile_home = Pathname( "./build" ).expand_path
45
+ end
35
46
  self.static_sourcesdir = compile_home + 'sources'
36
47
  self.static_builddir = compile_home + 'builds' + for_platform
37
48
 
@@ -67,17 +78,6 @@ class CrossLibrary < OpenStruct
67
78
  self.postgresql_lib = static_postgresql_libdir + 'libpq.dll'
68
79
  self.postgresql_patches = Rake::FileList[ (MISCDIR + "postgresql-#{postgresql_version}.*.patch").to_s ]
69
80
 
70
- # Use rake-compilers config.yml to determine the toolchain that was used
71
- # to build Ruby for this platform.
72
- self.host_platform = begin
73
- config_file = YAML.load_file(File.expand_path("~/.rake-compiler/config.yml"))
74
- _, rbfile = config_file.find{|key, fname| key.start_with?("rbconfig-#{for_platform}-") }
75
- IO.read(rbfile).match(/CONFIG\["CC"\] = "(.*)"/)[1].sub(/\-gcc/, '')
76
- rescue
77
- nil
78
- end
79
-
80
-
81
81
  # clean intermediate files and folders
82
82
  CLEAN.include( static_builddir.to_s )
83
83
 
@@ -217,6 +217,11 @@ class CrossLibrary < OpenStruct
217
217
 
218
218
  # make libpq.dll
219
219
  task postgresql_lib => [ postgresql_global_makefile ] do |t|
220
+ # Work around missing dependency to libcommon in PostgreSQL-9.4.0
221
+ chdir( static_postgresql_srcdir + "common" ) do
222
+ sh 'make', "-j#{NUM_CPUS}"
223
+ end
224
+
220
225
  chdir( postgresql_lib.dirname ) do
221
226
  sh 'make',
222
227
  "-j#{NUM_CPUS}",
@@ -246,10 +251,10 @@ end
246
251
 
247
252
  if File.exist?(File.expand_path("~/.rake-compiler/config.yml"))
248
253
  CrossLibraries = [
249
- ['i386-mingw32', 'mingw'],
250
- ['x64-mingw32', 'mingw64'],
251
- ].map do |platform, openssl_config|
252
- CrossLibrary.new platform, openssl_config
254
+ ['i386-mingw32', 'mingw', 'i686-w64-mingw32'],
255
+ ['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
256
+ ].map do |platform, openssl_config, toolchain|
257
+ CrossLibrary.new platform, openssl_config, toolchain
253
258
  end
254
259
  else
255
260
  $stderr.puts "Cross-compilation disabled -- rake-compiler not properly installed"
@@ -278,3 +283,19 @@ ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
278
283
  sh "x86_64-w64-mingw32-strip -S tmp/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/pg_ext.so"
279
284
  end
280
285
  end
286
+
287
+ desc "Build the windows binary gems"
288
+ task 'gem:windows' => ['ChangeLog'] do
289
+ require 'rake_compiler_dock'
290
+
291
+ # Copy gem signing key and certs to be accessable from the docker container
292
+ mkdir_p 'build/gem'
293
+ sh "cp ~/.gem/gem-*.pem build/gem/"
294
+
295
+ RakeCompilerDock.sh <<-EOT
296
+ mkdir ~/.gem &&
297
+ cp build/gem/gem-*.pem ~/.gem/ &&
298
+ bundle install &&
299
+ rake cross native gem RUBYOPT=--disable-rubygems RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2
300
+ EOT
301
+ end
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_connection.c - PG::Connection class extension
3
- * $Id: pg_connection.c,v 714601d05fba 2015/02/11 20:45:04 lars $
3
+ * $Id: pg_connection.c,v eb4d3c003bd6 2015/05/25 20:04:04 ged $
4
4
  *
5
5
  */
6
6
 
@@ -1534,7 +1534,7 @@ pgconn_s_escape(VALUE self, VALUE string)
1534
1534
  Check_Type(string, T_STRING);
1535
1535
 
1536
1536
  escaped = ALLOC_N(char, RSTRING_LEN(string) * 2 + 1);
1537
- if(rb_obj_class(self) == rb_cPGconn) {
1537
+ if( rb_obj_is_kind_of(self, rb_cPGconn) ) {
1538
1538
  size = PQescapeStringConn(pg_get_pgconn(self), escaped,
1539
1539
  RSTRING_PTR(string), RSTRING_LEN(string), &error);
1540
1540
  if(error) {
@@ -1547,7 +1547,7 @@ pgconn_s_escape(VALUE self, VALUE string)
1547
1547
  result = rb_str_new(escaped, size);
1548
1548
  xfree(escaped);
1549
1549
  OBJ_INFECT(result, string);
1550
- PG_ENCODING_SET_NOCHECK(result, ENCODING_GET( rb_obj_class(self) == rb_cPGconn ? self : string ));
1550
+ PG_ENCODING_SET_NOCHECK(result, ENCODING_GET( rb_obj_is_kind_of(self, rb_cPGconn) ? self : string ));
1551
1551
 
1552
1552
  return result;
1553
1553
  }
@@ -1587,7 +1587,7 @@ pgconn_s_escape_bytea(VALUE self, VALUE str)
1587
1587
  from = (unsigned char*)RSTRING_PTR(str);
1588
1588
  from_len = RSTRING_LEN(str);
1589
1589
 
1590
- if(rb_obj_class(self) == rb_cPGconn) {
1590
+ if ( rb_obj_is_kind_of(self, rb_cPGconn) ) {
1591
1591
  to = PQescapeByteaConn(pg_get_pgconn(self), from, from_len, &to_len);
1592
1592
  } else {
1593
1593
  to = PQescapeBytea( from, from_len, &to_len);
@@ -3031,7 +3031,7 @@ pgconn_s_quote_ident(VALUE self, VALUE in_str)
3031
3031
  pg_text_enc_identifier(NULL, in_str, NULL, &ret);
3032
3032
 
3033
3033
  OBJ_INFECT(ret, in_str);
3034
- PG_ENCODING_SET_NOCHECK(ret, ENCODING_GET( rb_obj_class(self) == rb_cPGconn ? self : in_str ));
3034
+ PG_ENCODING_SET_NOCHECK(ret, ENCODING_GET( rb_obj_is_kind_of(self, rb_cPGconn) ? self : in_str ));
3035
3035
 
3036
3036
  return ret;
3037
3037
  }
data/ext/util.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * util.c - Utils for ruby-pg
3
- * $Id: util.c,v b859963462b2 2015/03/13 17:39:35 lars $
3
+ * $Id: util.c,v 5fb9170f6a7d 2015/06/29 11:15:12 kanis $
4
4
  *
5
5
  */
6
6
 
@@ -17,7 +17,7 @@ static const char base64_encode_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk
17
17
  void
18
18
  base64_encode( char *out, char *in, int len)
19
19
  {
20
- char *in_ptr = in + len;
20
+ unsigned char *in_ptr = (unsigned char *)in + len;
21
21
  char *out_ptr = out + BASE64_ENCODED_SIZE(len);
22
22
  int part_len = len % 3;
23
23
 
data/lib/pg.rb CHANGED
@@ -24,10 +24,10 @@ end
24
24
  module PG
25
25
 
26
26
  # Library version
27
- VERSION = '0.18.2'
27
+ VERSION = '0.18.3'
28
28
 
29
29
  # VCS revision
30
- REVISION = %q$Revision: 7d31b04e7913 $
30
+ REVISION = %q$Revision: 3b49541c9f12 $
31
31
 
32
32
  class NotAllCopyDataRetrieved < PG::Error
33
33
  end
@@ -25,9 +25,9 @@ module PG::BasicTypeRegistry
25
25
 
26
26
  # populate the enum types
27
27
  _enums, leaves = leaves.partition { |row| row['typinput'] == 'enum_in' }
28
- # enums.each do |row|
29
- # coder_map[row['oid'].to_i] = OID::Enum.new
30
- # end
28
+ # enums.each do |row|
29
+ # coder_map[row['oid'].to_i] = OID::Enum.new
30
+ # end
31
31
 
32
32
  # populate the base types
33
33
  leaves.find_all { |row| coders_by_name.key?(row['typname']) }.each do |row|
@@ -41,9 +41,9 @@ module PG::BasicTypeRegistry
41
41
  _records_by_oid = result.group_by { |row| row['oid'] }
42
42
 
43
43
  # populate composite types
44
- # nodes.each do |row|
45
- # add_oid row, records_by_oid, coder_map
46
- # end
44
+ # nodes.each do |row|
45
+ # add_oid row, records_by_oid, coder_map
46
+ # end
47
47
 
48
48
  if arraycoder
49
49
  # populate array types
@@ -62,11 +62,11 @@ module PG::BasicTypeRegistry
62
62
  end
63
63
 
64
64
  # populate range types
65
- # ranges.find_all { |row| coder_map.key? row['rngsubtype'].to_i }.each do |row|
66
- # subcoder = coder_map[row['rngsubtype'].to_i]
67
- # range = OID::Range.new subcoder
68
- # coder_map[row['oid'].to_i] = range
69
- # end
65
+ # ranges.find_all { |row| coder_map.key? row['rngsubtype'].to_i }.each do |row|
66
+ # subcoder = coder_map[row['rngsubtype'].to_i]
67
+ # range = OID::Range.new subcoder
68
+ # coder_map[row['oid'].to_i] = range
69
+ # end
70
70
 
71
71
  @coders = coder_map.values
72
72
  @coders_by_name = @coders.inject({}){|h, t| h[t.name] = t; h }
@@ -154,46 +154,46 @@ module PG::BasicTypeRegistry
154
154
  alias_type 0, 'int8', 'int2'
155
155
  alias_type 0, 'oid', 'int2'
156
156
 
157
- # register_type 0, 'numeric', OID::Decimal.new
157
+ # register_type 0, 'numeric', OID::Decimal.new
158
158
  register_type 0, 'text', PG::TextEncoder::String, PG::TextDecoder::String
159
159
  alias_type 0, 'varchar', 'text'
160
160
  alias_type 0, 'char', 'text'
161
161
  alias_type 0, 'bpchar', 'text'
162
162
  alias_type 0, 'xml', 'text'
163
163
 
164
- # # FIXME: why are we keeping these types as strings?
165
- # alias_type 'tsvector', 'text'
166
- # alias_type 'interval', 'text'
167
- # alias_type 'macaddr', 'text'
168
- # alias_type 'uuid', 'text'
169
- #
170
- # register_type 'money', OID::Money.new
164
+ # FIXME: why are we keeping these types as strings?
165
+ # alias_type 'tsvector', 'text'
166
+ # alias_type 'interval', 'text'
167
+ # alias_type 'macaddr', 'text'
168
+ # alias_type 'uuid', 'text'
169
+ #
170
+ # register_type 'money', OID::Money.new
171
171
  # There is no PG::TextEncoder::Bytea, because it's simple and more efficient to send bytea-data
172
172
  # in binary format, either with PG::BinaryEncoder::Bytea or in Hash param format.
173
173
  register_type 0, 'bytea', nil, PG::TextDecoder::Bytea
174
174
  register_type 0, 'bool', PG::TextEncoder::Boolean, PG::TextDecoder::Boolean
175
- # register_type 'bit', OID::Bit.new
176
- # register_type 'varbit', OID::Bit.new
177
- #
175
+ # register_type 'bit', OID::Bit.new
176
+ # register_type 'varbit', OID::Bit.new
177
+
178
178
  register_type 0, 'float4', PG::TextEncoder::Float, PG::TextDecoder::Float
179
179
  alias_type 0, 'float8', 'float4'
180
180
 
181
181
  register_type 0, 'timestamp', PG::TextEncoder::TimestampWithoutTimeZone, PG::TextDecoder::TimestampWithoutTimeZone
182
182
  register_type 0, 'timestamptz', PG::TextEncoder::TimestampWithTimeZone, PG::TextDecoder::TimestampWithTimeZone
183
183
  register_type 0, 'date', PG::TextEncoder::Date, PG::TextDecoder::Date
184
- # register_type 'time', OID::Time.new
185
- #
186
- # register_type 'path', OID::Text.new
187
- # register_type 'point', OID::Point.new
188
- # register_type 'polygon', OID::Text.new
189
- # register_type 'circle', OID::Text.new
190
- # register_type 'hstore', OID::Hstore.new
191
- # register_type 'json', OID::Json.new
192
- # register_type 'citext', OID::Text.new
193
- # register_type 'ltree', OID::Text.new
194
- #
195
- # register_type 'cidr', OID::Cidr.new
196
- # alias_type 'inet', 'cidr'
184
+ # register_type 'time', OID::Time.new
185
+ #
186
+ # register_type 'path', OID::Text.new
187
+ # register_type 'point', OID::Point.new
188
+ # register_type 'polygon', OID::Text.new
189
+ # register_type 'circle', OID::Text.new
190
+ # register_type 'hstore', OID::Hstore.new
191
+ # register_type 'json', OID::Json.new
192
+ # register_type 'citext', OID::Text.new
193
+ # register_type 'ltree', OID::Text.new
194
+ #
195
+ # register_type 'cidr', OID::Cidr.new
196
+ # alias_type 'inet', 'cidr'
197
197
 
198
198
 
199
199
 
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'date'
4
+
3
5
  module PG
4
6
  module TextDecoder
5
7
  class Date < SimpleDecoder
@@ -7,7 +9,7 @@ module PG
7
9
 
8
10
  def decode(string, tuple=nil, field=nil)
9
11
  if string =~ ISO_DATE
10
- Time.new $1.to_i, $2.to_i, $3.to_i
12
+ ::Date.new $1.to_i, $2.to_i, $3.to_i
11
13
  else
12
14
  string
13
15
  end
@@ -255,7 +255,7 @@ module PG::TestingHelpers
255
255
  unless conns.empty?
256
256
  puts "Lingering connections remain:"
257
257
  conns.each do |row|
258
- puts " [%d] {%s} %s -- %s" % row.values_at( 'pid', 'state', 'application_name', 'query' )
258
+ puts " [%s] {%s} %s -- %s" % row.values_at( 'pid', 'state', 'application_name', 'query' )
259
259
  end
260
260
  end
261
261
  end
@@ -58,8 +58,8 @@ describe 'Basic type mapping' do
58
58
  it "should do OID based type conversions", :ruby_19 do
59
59
  res = @conn.exec( "SELECT 1, 'a', 2.0::FLOAT, TRUE, '2013-06-30'::DATE, generate_series(4,5)" )
60
60
  expect( res.map_types!(basic_type_mapping).values ).to eq( [
61
- [ 1, 'a', 2.0, true, Time.new(2013,6,30), 4 ],
62
- [ 1, 'a', 2.0, true, Time.new(2013,6,30), 5 ],
61
+ [ 1, 'a', 2.0, true, Date.new(2013,6,30), 4 ],
62
+ [ 1, 'a', 2.0, true, Date.new(2013,6,30), 5 ],
63
63
  ] )
64
64
  end
65
65
 
@@ -159,8 +159,8 @@ describe 'Basic type mapping' do
159
159
  CAST('1913-12-31' AS DATE),
160
160
  CAST('infinity' AS DATE),
161
161
  CAST('-infinity' AS DATE)", [], format )
162
- expect( res.getvalue(0,0) ).to eq( Time.new(2113, 12, 31) )
163
- expect( res.getvalue(0,1) ).to eq( Time.new(1913, 12, 31) )
162
+ expect( res.getvalue(0,0) ).to eq( Date.new(2113, 12, 31) )
163
+ expect( res.getvalue(0,1) ).to eq( Date.new(1913, 12, 31) )
164
164
  expect( res.getvalue(0,2) ).to eq( 'infinity' )
165
165
  expect( res.getvalue(0,3) ).to eq( '-infinity' )
166
166
  end
@@ -228,11 +228,14 @@ describe PG::Connection do
228
228
  expect( @conn.db ).to eq( "test" )
229
229
  expect( @conn.user ).to be_a_kind_of( String )
230
230
  expect( @conn.pass ).to eq( "" )
231
- expect( @conn.host ).to eq( "localhost" )
232
231
  expect( @conn.port ).to eq( 54321 )
233
232
  expect( @conn.tty ).to eq( "" )
234
233
  expect( @conn.options ).to eq( "" )
235
234
  end
235
+ it "can retrieve it's connection parameters for the established connection",
236
+ skip: RUBY_PLATFORM=~/x64-mingw/ ? "host segfaults on Windows-x64" : false do
237
+ expect( @conn.host ).to eq( "localhost" )
238
+ end
236
239
 
237
240
  EXPECTED_TRACE_OUTPUT = %{
238
241
  To backend> Msg Q
@@ -705,7 +708,7 @@ describe PG::Connection do
705
708
  it "can return the default connection options as a Hash" do
706
709
  expect( described_class.conndefaults_hash ).to be_a( Hash )
707
710
  expect( described_class.conndefaults_hash ).to include( :user, :password, :dbname, :host, :port )
708
- expect( described_class.conndefaults_hash[:port] ).to eq( '54321' )
711
+ expect( ['5432', '54321'] ).to include( described_class.conndefaults_hash[:port] )
709
712
  expect( @conn.conndefaults_hash ).to eq( described_class.conndefaults_hash )
710
713
  end
711
714
 
@@ -512,6 +512,7 @@ describe "PG::Type derivations" do
512
512
  expect( e.encode("xxxx") ).to eq("eHh4eA==")
513
513
  expect( e.encode("xxxxx") ).to eq("eHh4eHg=")
514
514
  expect( e.encode("\0\n\t") ).to eq("AAoJ")
515
+ expect( e.encode("(\xFBm") ).to eq("KPtt")
515
516
  end
516
517
 
517
518
  it "should encode Strings as base64 in BinaryDecoder" do
@@ -540,6 +541,7 @@ describe "PG::Type derivations" do
540
541
  expect( e.decode("eHh4eA==") ).to eq("xxxx")
541
542
  expect( e.decode("eHh4eHg=") ).to eq("xxxxx")
542
543
  expect( e.decode("AAoJ") ).to eq("\0\n\t")
544
+ expect( e.decode("KPtt") ).to eq("(\xFBm")
543
545
  end
544
546
 
545
547
  it "should decode base64 in BinaryEncoder" do
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.2
4
+ version: 0.18.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -31,7 +31,7 @@ cert_chain:
31
31
  G8LHR7EjtPPmqCCunfyecJ6MmCNaiJCBxq2NYzyNmluPyHT8+0fuB5kccUVZm6CD
32
32
  xn3DzOkDE6NYbk8gC9rTsA==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-05-14 00:00:00.000000000 Z
34
+ date: 2015-09-03 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe-mercurial
@@ -53,14 +53,14 @@ dependencies:
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0.6'
56
+ version: '0.7'
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '0.6'
63
+ version: '0.7'
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: hoe-highline
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,20 @@ dependencies:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0.9'
106
+ - !ruby/object:Gem::Dependency
107
+ name: rake-compiler-dock
108
+ requirement: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '0.3'
113
+ type: :development
114
+ prerelease: false
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.3'
106
120
  - !ruby/object:Gem::Dependency
107
121
  name: hoe
108
122
  requirement: !ruby/object:Gem::Requirement
@@ -315,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
329
  version: '0'
316
330
  requirements: []
317
331
  rubyforge_project:
318
- rubygems_version: 2.4.6
332
+ rubygems_version: 2.4.7
319
333
  signing_key:
320
334
  specification_version: 4
321
335
  summary: Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]
metadata.gz.sig CHANGED
Binary file