do_postgres 0.10.2-java → 0.10.3-java
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 +4 -0
- data/Rakefile +2 -2
- data/ext/do_postgres/do_postgres.c +44 -11
- data/ext/do_postgres/extconf.rb +2 -2
- data/lib/do_postgres/do_postgres.jar +0 -0
- data/lib/do_postgres/version.rb +1 -1
- data/spec/connection_spec.rb +9 -3
- data/spec/error/sql_error_spec.rb +8 -0
- data/spec/spec_helper.rb +4 -0
- data/tasks/compile.rake +1 -1
- data/tasks/release.rake +1 -1
- metadata +28 -10
data/ChangeLog.markdown
CHANGED
data/Rakefile
CHANGED
|
@@ -11,7 +11,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
|
|
|
11
11
|
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
|
|
12
12
|
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
|
|
13
13
|
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
|
14
|
-
BINARY_VERSION = '8.3.
|
|
14
|
+
BINARY_VERSION = '8.3.13'
|
|
15
15
|
|
|
16
16
|
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 ])
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ begin
|
|
|
38
38
|
gem.add_dependency 'data_objects', DataObjects::Postgres::VERSION
|
|
39
39
|
|
|
40
40
|
gem.add_development_dependency 'bacon', '~>1.1'
|
|
41
|
-
gem.add_development_dependency 'rake-compiler', '
|
|
41
|
+
gem.add_development_dependency 'rake-compiler', '= 0.7.0'
|
|
42
42
|
|
|
43
43
|
gem.has_rdoc = false
|
|
44
44
|
gem.rubyforge_project = 'dorb'
|
|
@@ -201,10 +201,10 @@ static VALUE parse_date_time(const char *date) {
|
|
|
201
201
|
do_int64 num, den;
|
|
202
202
|
|
|
203
203
|
long int gmt_offset;
|
|
204
|
-
int
|
|
204
|
+
int dst_adjustment;
|
|
205
205
|
|
|
206
206
|
time_t rawtime;
|
|
207
|
-
struct tm
|
|
207
|
+
struct tm timeinfo;
|
|
208
208
|
|
|
209
209
|
int tokens_read, max_tokens;
|
|
210
210
|
|
|
@@ -234,22 +234,50 @@ static VALUE parse_date_time(const char *date) {
|
|
|
234
234
|
}
|
|
235
235
|
// We read the Date and Time, default to the current locale's offset
|
|
236
236
|
|
|
237
|
+
tzset();
|
|
238
|
+
|
|
237
239
|
// Get localtime
|
|
238
240
|
time(&rawtime);
|
|
239
|
-
|
|
241
|
+
#ifdef HAVE_LOCALTIME_R
|
|
242
|
+
localtime_r(&rawtime, &timeinfo);
|
|
243
|
+
#else
|
|
244
|
+
// Thread unsafe, this is used on Windows...
|
|
245
|
+
timeinfo = *localtime(&rawtime);
|
|
246
|
+
#endif
|
|
240
247
|
|
|
241
|
-
|
|
248
|
+
timeinfo.tm_sec = sec;
|
|
249
|
+
timeinfo.tm_min = min;
|
|
250
|
+
timeinfo.tm_hour = hour;
|
|
251
|
+
timeinfo.tm_mday = day;
|
|
252
|
+
timeinfo.tm_mon = month;
|
|
253
|
+
timeinfo.tm_year = year - 1900;
|
|
254
|
+
timeinfo.tm_isdst = -1;
|
|
255
|
+
|
|
256
|
+
// Update tm_isdst
|
|
257
|
+
mktime(&timeinfo);
|
|
258
|
+
|
|
259
|
+
if (timeinfo.tm_isdst) {
|
|
260
|
+
dst_adjustment = 3600;
|
|
261
|
+
} else {
|
|
262
|
+
dst_adjustment = 0;
|
|
263
|
+
}
|
|
242
264
|
|
|
265
|
+
#ifdef HAVE_GMTIME_R
|
|
243
266
|
// Reset to GM Time
|
|
244
|
-
|
|
267
|
+
gmtime_r(&rawtime, &timeinfo);
|
|
268
|
+
#else
|
|
269
|
+
// Same as for localtime_r above
|
|
270
|
+
timeinfo = *gmtime(&rawtime);
|
|
271
|
+
#endif
|
|
245
272
|
|
|
246
|
-
gmt_offset = mktime(timeinfo)
|
|
273
|
+
gmt_offset = rawtime - mktime(&timeinfo);
|
|
247
274
|
|
|
248
|
-
if (
|
|
249
|
-
gmt_offset
|
|
275
|
+
if (dst_adjustment) {
|
|
276
|
+
gmt_offset += dst_adjustment;
|
|
277
|
+
}
|
|
250
278
|
|
|
251
|
-
hour_offset =
|
|
252
|
-
minute_offset =
|
|
279
|
+
hour_offset = ((int)gmt_offset / 3600);
|
|
280
|
+
minute_offset = ((int)gmt_offset % 3600 / 60);
|
|
253
281
|
|
|
254
282
|
} else {
|
|
255
283
|
// Something went terribly wrong
|
|
@@ -820,7 +848,11 @@ static VALUE cCommand_execute_non_query(int argc, VALUE *argv[], VALUE self) {
|
|
|
820
848
|
status = PQresultStatus(response);
|
|
821
849
|
|
|
822
850
|
if ( status == PGRES_TUPLES_OK ) {
|
|
823
|
-
|
|
851
|
+
if (PQgetlength(response, 0, 0) == 0) {
|
|
852
|
+
insert_id = Qnil;
|
|
853
|
+
} else {
|
|
854
|
+
insert_id = INT2NUM(atoi(PQgetvalue(response, 0, 0)));
|
|
855
|
+
}
|
|
824
856
|
affected_rows = INT2NUM(atoi(PQcmdTuples(response)));
|
|
825
857
|
}
|
|
826
858
|
else if ( status == PGRES_COMMAND_OK ) {
|
|
@@ -984,6 +1016,7 @@ static VALUE cReader_field_count(VALUE self) {
|
|
|
984
1016
|
|
|
985
1017
|
void Init_do_postgres() {
|
|
986
1018
|
rb_require("date");
|
|
1019
|
+
rb_require("rational");
|
|
987
1020
|
rb_require("bigdecimal");
|
|
988
1021
|
rb_require("data_objects");
|
|
989
1022
|
|
data/ext/do_postgres/extconf.rb
CHANGED
|
@@ -20,13 +20,13 @@ def have_build_env
|
|
|
20
20
|
have_header('catalog/pg_type.h')
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
$CFLAGS << '-UENABLE_NLS -DHAVE_GETTIMEOFDAY -DHAVE_CRYPT' if RUBY_PLATFORM =~ /mswin|mingw/
|
|
23
|
+
$CFLAGS << ' -UENABLE_NLS -DHAVE_GETTIMEOFDAY -DHAVE_CRYPT' if RUBY_PLATFORM =~ /mswin|mingw/
|
|
24
24
|
|
|
25
25
|
dir_config('pgsql-server', config_value('includedir-server'), config_value('libdir'))
|
|
26
26
|
dir_config('pgsql-client', config_value('includedir'), config_value('libdir'))
|
|
27
27
|
dir_config('pgsql-win32') if RUBY_PLATFORM =~ /mswin|mingw/
|
|
28
28
|
|
|
29
|
-
desired_functions = %w(PQsetClientEncoding pg_encoding_to_char PQfreemem)
|
|
29
|
+
desired_functions = %w(localtime_r gmtime_r PQsetClientEncoding pg_encoding_to_char PQfreemem)
|
|
30
30
|
compat_functions = %w(PQescapeString PQexecParams)
|
|
31
31
|
|
|
32
32
|
if have_build_env
|
|
Binary file
|
data/lib/do_postgres/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
|
@@ -19,16 +19,22 @@ describe DataObjects::Postgres::Connection do
|
|
|
19
19
|
# FIXME: behaves_like 'a Connection with JDBC URL support' if JRUBY
|
|
20
20
|
|
|
21
21
|
describe 'byte array quoting' do
|
|
22
|
+
# There are two possible byte array quotings available: hex or escape.
|
|
23
|
+
# The default changed from escape to hex in version 9, so these specs
|
|
24
|
+
# check for either.
|
|
25
|
+
#
|
|
26
|
+
# http://developer.postgresql.org/pgdocs/postgres/datatype-binary.html
|
|
27
|
+
# http://developer.postgresql.org/pgdocs/postgres/release-9-0.html (E.3.2.3.)
|
|
22
28
|
it 'should properly escape non-printable ASCII characters' do
|
|
23
|
-
@connection.quote_byte_array("\001")
|
|
29
|
+
["'\\001'", "'\\x01'"].should.include @connection.quote_byte_array("\001")
|
|
24
30
|
end
|
|
25
31
|
|
|
26
32
|
it 'should properly escape bytes with the high bit set' do
|
|
27
|
-
@connection.quote_byte_array("\210")
|
|
33
|
+
["'\\210'", "'\\x88'"].should.include @connection.quote_byte_array("\210")
|
|
28
34
|
end
|
|
29
35
|
|
|
30
36
|
it 'should not escape printable ASCII characters' do
|
|
31
|
-
@connection.quote_byte_array("a")
|
|
37
|
+
["'a'", "'\\x61'"].should.include @connection.quote_byte_array("a")
|
|
32
38
|
end
|
|
33
39
|
end
|
|
34
40
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -139,6 +139,10 @@ module DataObjectsSpecHelpers
|
|
|
139
139
|
update widgets set release_timestamp = NULL where id = 9
|
|
140
140
|
EOF
|
|
141
141
|
|
|
142
|
+
conn.create_command(<<-EOF).execute_non_query
|
|
143
|
+
update widgets set release_datetime = '2008-07-14 00:31:12' where id = 10
|
|
144
|
+
EOF
|
|
145
|
+
|
|
142
146
|
conn.close
|
|
143
147
|
|
|
144
148
|
end
|
data/tasks/compile.rake
CHANGED
data/tasks/release.rake
CHANGED
metadata
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: do_postgres
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 49
|
|
4
5
|
prerelease: false
|
|
5
6
|
segments:
|
|
6
7
|
- 0
|
|
7
8
|
- 10
|
|
8
|
-
-
|
|
9
|
-
version: 0.10.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.10.3
|
|
10
11
|
platform: java
|
|
11
12
|
authors:
|
|
12
13
|
- Dirkjan Bussink
|
|
@@ -14,30 +15,34 @@ autorequire:
|
|
|
14
15
|
bindir: bin
|
|
15
16
|
cert_chain: []
|
|
16
17
|
|
|
17
|
-
date:
|
|
18
|
+
date: 2011-01-30 00:00:00 +01:00
|
|
18
19
|
default_executable:
|
|
19
20
|
dependencies:
|
|
20
21
|
- !ruby/object:Gem::Dependency
|
|
21
22
|
name: data_objects
|
|
22
23
|
prerelease: false
|
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
24
26
|
requirements:
|
|
25
27
|
- - "="
|
|
26
28
|
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 49
|
|
27
30
|
segments:
|
|
28
31
|
- 0
|
|
29
32
|
- 10
|
|
30
|
-
-
|
|
31
|
-
version: 0.10.
|
|
33
|
+
- 3
|
|
34
|
+
version: 0.10.3
|
|
32
35
|
type: :runtime
|
|
33
36
|
version_requirements: *id001
|
|
34
37
|
- !ruby/object:Gem::Dependency
|
|
35
38
|
name: bacon
|
|
36
39
|
prerelease: false
|
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
38
42
|
requirements:
|
|
39
43
|
- - ~>
|
|
40
44
|
- !ruby/object:Gem::Version
|
|
45
|
+
hash: 13
|
|
41
46
|
segments:
|
|
42
47
|
- 1
|
|
43
48
|
- 1
|
|
@@ -48,22 +53,27 @@ dependencies:
|
|
|
48
53
|
name: rake-compiler
|
|
49
54
|
prerelease: false
|
|
50
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
56
|
+
none: false
|
|
51
57
|
requirements:
|
|
52
|
-
- -
|
|
58
|
+
- - "="
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
60
|
+
hash: 3
|
|
54
61
|
segments:
|
|
55
62
|
- 0
|
|
56
63
|
- 7
|
|
57
|
-
|
|
64
|
+
- 0
|
|
65
|
+
version: 0.7.0
|
|
58
66
|
type: :development
|
|
59
67
|
version_requirements: *id003
|
|
60
68
|
- !ruby/object:Gem::Dependency
|
|
61
69
|
name: jdbc-postgres
|
|
62
70
|
prerelease: false
|
|
63
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
64
73
|
requirements:
|
|
65
74
|
- - ">="
|
|
66
75
|
- !ruby/object:Gem::Version
|
|
76
|
+
hash: 47
|
|
67
77
|
segments:
|
|
68
78
|
- 8
|
|
69
79
|
- 2
|
|
@@ -74,14 +84,16 @@ dependencies:
|
|
|
74
84
|
name: do_jdbc
|
|
75
85
|
prerelease: false
|
|
76
86
|
requirement: &id005 !ruby/object:Gem::Requirement
|
|
87
|
+
none: false
|
|
77
88
|
requirements:
|
|
78
89
|
- - "="
|
|
79
90
|
- !ruby/object:Gem::Version
|
|
91
|
+
hash: 49
|
|
80
92
|
segments:
|
|
81
93
|
- 0
|
|
82
94
|
- 10
|
|
83
|
-
-
|
|
84
|
-
version: 0.10.
|
|
95
|
+
- 3
|
|
96
|
+
version: 0.10.3
|
|
85
97
|
type: :runtime
|
|
86
98
|
version_requirements: *id005
|
|
87
99
|
description: Implements the DataObjects API for PostgreSQL
|
|
@@ -102,6 +114,7 @@ files:
|
|
|
102
114
|
- spec/command_spec.rb
|
|
103
115
|
- spec/connection_spec.rb
|
|
104
116
|
- spec/encoding_spec.rb
|
|
117
|
+
- spec/error/sql_error_spec.rb
|
|
105
118
|
- spec/reader_spec.rb
|
|
106
119
|
- spec/result_spec.rb
|
|
107
120
|
- spec/spec_helper.rb
|
|
@@ -143,23 +156,27 @@ rdoc_options:
|
|
|
143
156
|
require_paths:
|
|
144
157
|
- lib
|
|
145
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
|
+
none: false
|
|
146
160
|
requirements:
|
|
147
161
|
- - ">="
|
|
148
162
|
- !ruby/object:Gem::Version
|
|
163
|
+
hash: 3
|
|
149
164
|
segments:
|
|
150
165
|
- 0
|
|
151
166
|
version: "0"
|
|
152
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
|
+
none: false
|
|
153
169
|
requirements:
|
|
154
170
|
- - ">="
|
|
155
171
|
- !ruby/object:Gem::Version
|
|
172
|
+
hash: 3
|
|
156
173
|
segments:
|
|
157
174
|
- 0
|
|
158
175
|
version: "0"
|
|
159
176
|
requirements: []
|
|
160
177
|
|
|
161
178
|
rubyforge_project: dorb
|
|
162
|
-
rubygems_version: 1.3.
|
|
179
|
+
rubygems_version: 1.3.7
|
|
163
180
|
signing_key:
|
|
164
181
|
specification_version: 3
|
|
165
182
|
summary: DataObjects PostgreSQL Driver
|
|
@@ -167,6 +184,7 @@ test_files:
|
|
|
167
184
|
- spec/command_spec.rb
|
|
168
185
|
- spec/connection_spec.rb
|
|
169
186
|
- spec/encoding_spec.rb
|
|
187
|
+
- spec/error/sql_error_spec.rb
|
|
170
188
|
- spec/reader_spec.rb
|
|
171
189
|
- spec/result_spec.rb
|
|
172
190
|
- spec/spec_helper.rb
|