do_postgres 0.10.8-x86-mingw32 → 0.10.9-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.10.9 2012-08-13
2
+
3
+ * Improved RETURNING handling on JRuby
4
+ * Allow for an empty database name
5
+
1
6
  ## 0.10.8 2012-02-10
2
7
 
3
8
  * Ruby 1.9.3 compatibility on Windows
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
15
15
  IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
16
16
  WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
17
17
  SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
18
- BINARY_VERSION = '8.3.15'
18
+ BINARY_VERSION = '8.4.12'
19
19
 
20
20
  CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_postgres/Makefile ext-java/target ])
21
21
 
@@ -185,6 +185,10 @@ VALUE data_objects_parse_date(const char *date) {
185
185
  return Qnil;
186
186
  }
187
187
 
188
+ if(!year && !month && !day) {
189
+ return Qnil;
190
+ }
191
+
188
192
  return rb_funcall(rb_cDate, ID_NEW, 3, INT2NUM(year), INT2NUM(month), INT2NUM(day));
189
193
  }
190
194
 
@@ -237,6 +241,10 @@ VALUE data_objects_parse_date_time(const char *date) {
237
241
  fmt_datetime = strchr(date, '.') ? _fmt_datetime_tz_subsec : _fmt_datetime_tz_normal;
238
242
  tokens_read = sscanf(date, fmt_datetime, &year, &month, &day, &hour, &min, &sec, &hour_offset, &minute_offset);
239
243
 
244
+ if(!year && !month && !day && !hour && !min && !sec) {
245
+ return Qnil;
246
+ }
247
+
240
248
  switch (tokens_read) {
241
249
  case 8:
242
250
  minute_offset *= hour_offset < 0 ? -1 : 1;
@@ -395,7 +395,7 @@ void do_postgres_full_connect(VALUE self, PGconn *db) {
395
395
  }
396
396
 
397
397
  if (!database || !*database) {
398
- rb_raise(eConnectionError, "Database must be specified");
398
+ database = NULL;
399
399
  }
400
400
 
401
401
  VALUE r_query = rb_iv_get(self, "@query");
data/lib/do_postgres.rb CHANGED
@@ -11,7 +11,7 @@ if RUBY_PLATFORM =~ /java/
11
11
 
12
12
  begin
13
13
  java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Postgres::JDBC_DRIVER, true)
14
- rescue
14
+ rescue java.lang.ClassNotFoundException
15
15
  require 'jdbc/postgres' # the JDBC driver, packaged as a gem
16
16
  end
17
17
 
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  module DataObjects
2
2
  module Postgres
3
- VERSION = '0.10.8'
3
+ VERSION = '0.10.9'
4
4
  end
5
5
  end
data/spec/command_spec.rb CHANGED
@@ -6,4 +6,40 @@ require 'data_objects/spec/shared/command_spec'
6
6
  describe DataObjects::Postgres::Command do
7
7
  it_should_behave_like 'a Command'
8
8
  it_should_behave_like 'a Command with async'
9
+
10
+ describe 'query with RETURNING while not returning result' do
11
+ before do
12
+ @connection = DataObjects::Connection.new(CONFIG.uri)
13
+ @select_command = @connection.create_command("SELECT name FROM users WHERE id = 900")
14
+ @upsert_command = @connection.create_command("
15
+ WITH upsert AS
16
+ (UPDATE users SET name = ? WHERE id = 900 RETURNING id)
17
+ INSERT INTO users (id, name)
18
+ SELECT 900, 'dbussink' WHERE NOT EXISTS (SELECT 1 FROM upsert)")
19
+ end
20
+
21
+ after do
22
+ @connection.close
23
+ end
24
+
25
+ it "should work with a writable CTE acting as an Upsert" do
26
+ reader = @select_command.execute_reader
27
+ reader.to_a.size.should == 0
28
+ reader.close
29
+
30
+ @upsert_command.execute_non_query('jwkoelewijn')
31
+
32
+ reader = @select_command.execute_reader
33
+ reader.next!
34
+ reader.values[0].should == 'dbussink'
35
+ reader.close
36
+
37
+ @upsert_command.execute_non_query('jwkoelewijn')
38
+
39
+ reader = @select_command.execute_reader
40
+ reader.next!
41
+ reader.values[0].should == 'jwkoelewijn'
42
+ reader.close
43
+ end
44
+ end
9
45
  end
@@ -16,6 +16,7 @@ describe DataObjects::Postgres::Connection do
16
16
 
17
17
  it_should_behave_like 'a Connection'
18
18
  it_should_behave_like 'a Connection with authentication support'
19
+ it_should_behave_like 'a Connection allowing default database'
19
20
  it_should_behave_like 'a Connection with JDBC URL support' if JRUBY
20
21
 
21
22
  describe 'byte array quoting' do
data/tasks/compile.rake CHANGED
@@ -40,7 +40,7 @@ begin
40
40
  At the time of building this gem, the necessary DLL files where available
41
41
  in the following download:
42
42
 
43
- http://wwwmaster.postgresql.org/redir/107/h/binary/v#{BINARY_VERSION}/win32/postgresql-#{BINARY_VERSION}-1-binaries-no-installer.zip
43
+ http://wwwmaster.postgresql.org/redir/107/h/binary/v#{BINARY_VERSION}/win32/postgresql-#{BINARY_VERSION}-1-windows-binaries.zip
44
44
 
45
45
  You can put the following files available in this package in your Ruby bin
46
46
  directory, for example C:\\Ruby\\bin
@@ -70,7 +70,7 @@ begin
70
70
  ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
71
71
  ext.java_compiling do |gem|
72
72
  gem.add_dependency 'jdbc-postgres', '>=8.2'
73
- gem.add_dependency 'do_jdbc', '0.10.8'
73
+ gem.add_dependency 'do_jdbc', '0.10.9'
74
74
  end
75
75
  end
76
76
  rescue LoadError
data/tasks/retrieve.rake CHANGED
@@ -33,7 +33,7 @@ begin
33
33
  end
34
34
 
35
35
  version = BINARY_VERSION
36
- file "vendor/postgresql-#{version}-1-binaries-no-installer.zip" => ['vendor'] do |t|
36
+ file "vendor/postgresql-#{version}-1-windows-binaries.zip" => ['vendor'] do |t|
37
37
  url = "http://wwwmaster.postgresql.org/redir/107/h/binary/v#{version}/win32/#{File.basename(t.name)}"
38
38
  when_writing "downloading #{t.name}" do
39
39
  cd File.dirname(t.name) do
@@ -42,7 +42,7 @@ begin
42
42
  end
43
43
  end
44
44
 
45
- file "vendor/pgsql/include/pg_config.h" => ["vendor/postgresql-#{version}-1-binaries-no-installer.zip"] do |t|
45
+ file "vendor/pgsql/include/pg_config.h" => ["vendor/postgresql-#{version}-1-windows-binaries.zip"] do |t|
46
46
  full_file = File.expand_path(t.prerequisites.last)
47
47
  when_writing "creating #{t.name}" do
48
48
  cd "vendor" do
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_postgres
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 10
9
- - 8
10
- version: 0.10.8
8
+ - 9
9
+ version: 0.10.9
11
10
  platform: x86-mingw32
12
11
  authors:
13
12
  - Dirkjan Bussink
@@ -15,53 +14,48 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-03-29 00:00:00 Z
17
+ date: 2011-03-29 00:00:00 +02:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ type: :runtime
23
+ name: data_objects
21
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
25
  requirements:
24
26
  - - "="
25
27
  - !ruby/object:Gem::Version
26
- hash: 39
27
28
  segments:
28
29
  - 0
29
30
  - 10
30
- - 8
31
- version: 0.10.8
32
- name: data_objects
33
- prerelease: false
34
- type: :runtime
31
+ - 9
32
+ version: 0.10.9
35
33
  requirement: *id001
36
34
  - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ type: :development
37
+ name: rspec
37
38
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
39
  requirements:
40
40
  - - ~>
41
41
  - !ruby/object:Gem::Version
42
- hash: 9
43
42
  segments:
44
43
  - 2
45
44
  - 5
46
45
  version: "2.5"
47
- name: rspec
48
- prerelease: false
49
- type: :development
50
46
  requirement: *id002
51
47
  - !ruby/object:Gem::Dependency
48
+ prerelease: false
49
+ type: :development
50
+ name: rake-compiler
52
51
  version_requirements: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
52
  requirements:
55
53
  - - ~>
56
54
  - !ruby/object:Gem::Version
57
- hash: 5
58
55
  segments:
59
56
  - 0
60
57
  - 7
61
58
  version: "0.7"
62
- name: rake-compiler
63
- prerelease: false
64
- type: :development
65
59
  requirement: *id003
66
60
  description: Implements the DataObjects API for PostgreSQL
67
61
  email: d.bussink@gmail.com
@@ -116,6 +110,7 @@ files:
116
110
  - tasks/spec.rake
117
111
  - lib/do_postgres/1.8/do_postgres.so
118
112
  - lib/do_postgres/1.9/do_postgres.so
113
+ has_rdoc: true
119
114
  homepage:
120
115
  licenses: []
121
116
 
@@ -124,13 +119,13 @@ post_install_message: |+
124
119
  ======================================================================================================
125
120
 
126
121
  You've installed the binary version of do_postgres.
127
- It was built using PostgreSQL version 8.3.15.
122
+ It was built using PostgreSQL version 8.4.12.
128
123
  It's recommended to use the exact same version to avoid potential issues.
129
124
 
130
125
  At the time of building this gem, the necessary DLL files where available
131
126
  in the following download:
132
127
 
133
- http://wwwmaster.postgresql.org/redir/107/h/binary/v8.3.15/win32/postgresql-8.3.15-1-binaries-no-installer.zip
128
+ http://wwwmaster.postgresql.org/redir/107/h/binary/v8.4.12/win32/postgresql-8.4.12-1-windows-binaries.zip
134
129
 
135
130
  You can put the following files available in this package in your Ruby bin
136
131
  directory, for example C:\Ruby\bin
@@ -152,27 +147,23 @@ rdoc_options: []
152
147
  require_paths:
153
148
  - lib
154
149
  required_ruby_version: !ruby/object:Gem::Requirement
155
- none: false
156
150
  requirements:
157
151
  - - ">="
158
152
  - !ruby/object:Gem::Version
159
- hash: 3
160
153
  segments:
161
154
  - 0
162
155
  version: "0"
163
156
  required_rubygems_version: !ruby/object:Gem::Requirement
164
- none: false
165
157
  requirements:
166
158
  - - ">="
167
159
  - !ruby/object:Gem::Version
168
- hash: 3
169
160
  segments:
170
161
  - 0
171
162
  version: "0"
172
163
  requirements: []
173
164
 
174
165
  rubyforge_project: dorb
175
- rubygems_version: 1.8.14
166
+ rubygems_version: 1.3.6
176
167
  signing_key:
177
168
  specification_version: 3
178
169
  summary: DataObjects PostgreSQL Driver