do_sqlite3 0.10.8-java → 0.10.9-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.
@@ -1,3 +1,7 @@
1
+ ## 0.10.9 2012-08-13
2
+
3
+ * Fix segfault when loading custom extensions
4
+
1
5
  ## 0.10.8 2012-02-10
2
6
 
3
7
  * 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 = '3070600'
18
+ BINARY_VERSION = '3071300'
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_sqlite3/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;
@@ -172,7 +172,8 @@ VALUE do_sqlite3_cConnection_dispose(VALUE self) {
172
172
  return Qfalse;
173
173
  }
174
174
 
175
- sqlite3 *db = DATA_PTR(connection_container);
175
+ sqlite3 *db;
176
+ Data_Get_Struct(connection_container, sqlite3, db);
176
177
 
177
178
  if (!db) {
178
179
  return Qfalse;
@@ -16,12 +16,15 @@ VALUE do_sqlite3_cExtension_enable_load_extension(VALUE self, VALUE on) {
16
16
  if (connection == Qnil) { return Qfalse; }
17
17
 
18
18
  // Retrieve the actual connection from the
19
- connection = rb_iv_get(self, "@connection");
19
+ VALUE sqlite3_connection = rb_iv_get(connection, "@connection");
20
20
 
21
- if (connection == Qnil) { return Qfalse; }
21
+ if (sqlite3_connection == Qnil) { return Qfalse; }
22
22
 
23
23
  sqlite3 *db;
24
24
 
25
+ Data_Get_Struct(sqlite3_connection, sqlite3, db);
26
+
27
+
25
28
  if (!(db = DATA_PTR(connection))) {
26
29
  return Qfalse;
27
30
  }
@@ -40,26 +43,23 @@ VALUE do_sqlite3_cExtension_enable_load_extension(VALUE self, VALUE on) {
40
43
 
41
44
  VALUE do_sqlite3_cExtension_load_extension(VALUE self, VALUE path) {
42
45
  #ifdef HAVE_SQLITE3_ENABLE_LOAD_EXTENSION
43
- VALUE id_connection = rb_intern("connection");
44
- VALUE connection = rb_funcall(self, id_connection, 0);
46
+ VALUE connection = rb_iv_get(self, "@connection");
45
47
 
46
48
  if (connection == Qnil) { return Qfalse; }
47
49
 
48
- // Retrieve the actual connection from the
49
- connection = rb_iv_get(self, "@connection");
50
+ // Retrieve the actual connection from the object
51
+ VALUE sqlite3_connection = rb_iv_get(connection, "@connection");
50
52
 
51
- if (connection == Qnil) { return Qfalse; }
53
+ if (sqlite3_connection == Qnil) { return Qfalse; }
52
54
 
53
55
  sqlite3 *db;
54
56
 
55
- if (!(db = DATA_PTR(connection))) {
56
- return Qfalse;
57
- }
57
+ Data_Get_Struct(sqlite3_connection, sqlite3, db);
58
58
 
59
59
  const char *extension_path = rb_str_ptr_readonly(path);
60
- char *errmsg;
60
+ char *errmsg = sqlite3_malloc(1024);
61
61
 
62
- if (!(errmsg = sqlite3_malloc(1024))) {
62
+ if (!errmsg) {
63
63
  return Qfalse;
64
64
  }
65
65
 
@@ -72,6 +72,7 @@ VALUE do_sqlite3_cExtension_load_extension(VALUE self, VALUE path) {
72
72
  rb_exc_raise(errexp);
73
73
  }
74
74
 
75
+ sqlite3_free(errmsg);
75
76
  return Qtrue;
76
77
  #else
77
78
  return Qfalse;
@@ -11,7 +11,7 @@ if RUBY_PLATFORM =~ /java/
11
11
 
12
12
  begin
13
13
  java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Sqlite3::JDBC_DRIVER, true)
14
- rescue
14
+ rescue java.lang.ClassNotFoundException
15
15
  require 'jdbc/sqlite3' # the JDBC driver, packaged as a gem
16
16
  end
17
17
 
@@ -1,5 +1,5 @@
1
1
  module DataObjects
2
2
  module Sqlite3
3
- VERSION = '0.10.8'
3
+ VERSION = '0.10.9'
4
4
  end
5
5
  end
@@ -55,7 +55,7 @@ begin
55
55
  ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
56
56
  ext.java_compiling do |gem|
57
57
  gem.add_dependency 'jdbc-sqlite3', '>=3.5.8'
58
- gem.add_dependency 'do_jdbc', '0.10.8'
58
+ gem.add_dependency 'do_jdbc', '0.10.9'
59
59
  end
60
60
  end
61
61
  rescue LoadError
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_sqlite3
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: java
12
11
  authors:
13
12
  - Dirkjan Bussink
@@ -15,85 +14,76 @@ 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
  - !ruby/object:Gem::Dependency
61
+ prerelease: false
62
+ type: :runtime
63
+ name: jdbc-sqlite3
67
64
  version_requirements: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
65
  requirements:
70
66
  - - ">="
71
67
  - !ruby/object:Gem::Version
72
- hash: 3
73
68
  segments:
74
69
  - 3
75
70
  - 5
76
71
  - 8
77
72
  version: 3.5.8
78
- name: jdbc-sqlite3
79
- prerelease: false
80
- type: :runtime
81
73
  requirement: *id004
82
74
  - !ruby/object:Gem::Dependency
75
+ prerelease: false
76
+ type: :runtime
77
+ name: do_jdbc
83
78
  version_requirements: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
79
  requirements:
86
80
  - - "="
87
81
  - !ruby/object:Gem::Version
88
- hash: 39
89
82
  segments:
90
83
  - 0
91
84
  - 10
92
- - 8
93
- version: 0.10.8
94
- name: do_jdbc
95
- prerelease: false
96
- type: :runtime
85
+ - 9
86
+ version: 0.10.9
97
87
  requirement: *id005
98
88
  description: Implements the DataObjects API for Sqlite3
99
89
  email: d.bussink@gmail.com
@@ -147,6 +137,7 @@ files:
147
137
  - tasks/retrieve.rake
148
138
  - tasks/spec.rake
149
139
  - lib/do_sqlite3/do_sqlite3.jar
140
+ has_rdoc: true
150
141
  homepage:
151
142
  licenses: []
152
143
 
@@ -156,27 +147,23 @@ rdoc_options: []
156
147
  require_paths:
157
148
  - lib
158
149
  required_ruby_version: !ruby/object:Gem::Requirement
159
- none: false
160
150
  requirements:
161
151
  - - ">="
162
152
  - !ruby/object:Gem::Version
163
- hash: 3
164
153
  segments:
165
154
  - 0
166
155
  version: "0"
167
156
  required_rubygems_version: !ruby/object:Gem::Requirement
168
- none: false
169
157
  requirements:
170
158
  - - ">="
171
159
  - !ruby/object:Gem::Version
172
- hash: 3
173
160
  segments:
174
161
  - 0
175
162
  version: "0"
176
163
  requirements: []
177
164
 
178
165
  rubyforge_project: dorb
179
- rubygems_version: 1.8.14
166
+ rubygems_version: 1.3.6
180
167
  signing_key:
181
168
  specification_version: 3
182
169
  summary: DataObjects Sqlite3 Driver