do_postgres 0.10.8 → 0.10.9
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/ChangeLog.markdown +5 -0
- data/Rakefile +1 -1
- data/ext/do_postgres/do_common.c +8 -0
- data/ext/do_postgres/do_postgres.c +1 -1
- data/lib/do_postgres/version.rb +1 -1
- data/lib/do_postgres.rb +1 -1
- data/spec/command_spec.rb +36 -0
- data/spec/connection_spec.rb +1 -0
- data/tasks/compile.rake +2 -2
- data/tasks/retrieve.rake +2 -2
- metadata +9 -18
data/ChangeLog.markdown
CHANGED
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.
|
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
|
|
data/ext/do_postgres/do_common.c
CHANGED
@@ -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;
|
data/lib/do_postgres/version.rb
CHANGED
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
|
|
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
|
data/spec/connection_spec.rb
CHANGED
@@ -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
|
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.
|
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
|
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
|
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
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 10
|
9
|
-
-
|
10
|
-
version: 0.10.
|
8
|
+
- 9
|
9
|
+
version: 0.10.9
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Dirkjan Bussink
|
@@ -15,33 +14,30 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-03-29 00:00:00
|
17
|
+
date: 2011-03-29 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: data_objects
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
24
|
requirements:
|
26
25
|
- - "="
|
27
26
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 39
|
29
27
|
segments:
|
30
28
|
- 0
|
31
29
|
- 10
|
32
|
-
-
|
33
|
-
version: 0.10.
|
30
|
+
- 9
|
31
|
+
version: 0.10.9
|
34
32
|
type: :runtime
|
35
33
|
version_requirements: *id001
|
36
34
|
- !ruby/object:Gem::Dependency
|
37
35
|
name: rspec
|
38
36
|
prerelease: false
|
39
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
38
|
requirements:
|
42
39
|
- - ~>
|
43
40
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 9
|
45
41
|
segments:
|
46
42
|
- 2
|
47
43
|
- 5
|
@@ -52,11 +48,9 @@ dependencies:
|
|
52
48
|
name: rake-compiler
|
53
49
|
prerelease: false
|
54
50
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
51
|
requirements:
|
57
52
|
- - ~>
|
58
53
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 5
|
60
54
|
segments:
|
61
55
|
- 0
|
62
56
|
- 7
|
@@ -114,6 +108,7 @@ files:
|
|
114
108
|
- tasks/release.rake
|
115
109
|
- tasks/retrieve.rake
|
116
110
|
- tasks/spec.rake
|
111
|
+
has_rdoc: true
|
117
112
|
homepage:
|
118
113
|
licenses: []
|
119
114
|
|
@@ -123,27 +118,23 @@ rdoc_options: []
|
|
123
118
|
require_paths:
|
124
119
|
- lib
|
125
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
121
|
requirements:
|
128
122
|
- - ">="
|
129
123
|
- !ruby/object:Gem::Version
|
130
|
-
hash: 3
|
131
124
|
segments:
|
132
125
|
- 0
|
133
126
|
version: "0"
|
134
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
128
|
requirements:
|
137
129
|
- - ">="
|
138
130
|
- !ruby/object:Gem::Version
|
139
|
-
hash: 3
|
140
131
|
segments:
|
141
132
|
- 0
|
142
133
|
version: "0"
|
143
134
|
requirements: []
|
144
135
|
|
145
136
|
rubyforge_project: dorb
|
146
|
-
rubygems_version: 1.
|
137
|
+
rubygems_version: 1.3.6
|
147
138
|
signing_key:
|
148
139
|
specification_version: 3
|
149
140
|
summary: DataObjects PostgreSQL Driver
|