do_sqlite3 0.10.9-x86-mingw32 → 0.10.10-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +4 -0
- data/ext/do_sqlite3/do_sqlite3.c +19 -0
- data/lib/do_sqlite3/1.8/do_sqlite3.so +0 -0
- data/lib/do_sqlite3/1.9/do_sqlite3.so +0 -0
- data/lib/do_sqlite3/version.rb +1 -1
- data/spec/connection_spec.rb +17 -0
- data/tasks/compile.rake +1 -1
- metadata +4 -4
data/ChangeLog.markdown
CHANGED
data/ext/do_sqlite3/do_sqlite3.c
CHANGED
@@ -137,6 +137,20 @@ int do_sqlite3_flags_from_uri(VALUE uri) {
|
|
137
137
|
|
138
138
|
#endif
|
139
139
|
|
140
|
+
|
141
|
+
int do_sqlite3_busy_timeout_from_uri(VALUE uri) {
|
142
|
+
VALUE query_values = rb_funcall(uri, rb_intern("query"), 0);
|
143
|
+
if(query_values != Qnil && TYPE(query_values) == T_HASH) {
|
144
|
+
VALUE timeout = rb_hash_aref(query_values, rb_str_new2("busy_timeout"));
|
145
|
+
if(timeout == Qnil) {
|
146
|
+
return -1;
|
147
|
+
}
|
148
|
+
|
149
|
+
return rb_cstr2inum(RSTRING_PTR(timeout), 0);
|
150
|
+
}
|
151
|
+
return -1;
|
152
|
+
}
|
153
|
+
|
140
154
|
/****** Public API ******/
|
141
155
|
|
142
156
|
VALUE do_sqlite3_cConnection_initialize(VALUE self, VALUE uri) {
|
@@ -154,6 +168,11 @@ VALUE do_sqlite3_cConnection_initialize(VALUE self, VALUE uri) {
|
|
154
168
|
do_sqlite3_raise_error(self, db, Qnil);
|
155
169
|
}
|
156
170
|
|
171
|
+
int timeout = do_sqlite3_busy_timeout_from_uri(uri);
|
172
|
+
if(timeout > 0) {
|
173
|
+
sqlite3_busy_timeout(db, timeout);
|
174
|
+
}
|
175
|
+
|
157
176
|
rb_iv_set(self, "@uri", uri);
|
158
177
|
rb_iv_set(self, "@connection", Data_Wrap_Struct(rb_cObject, 0, 0, db));
|
159
178
|
// Sqlite3 only supports UTF-8, so this is the standard encoding
|
Binary file
|
Binary file
|
data/lib/do_sqlite3/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -17,4 +17,21 @@ describe DataObjects::Sqlite3::Connection do
|
|
17
17
|
it_should_behave_like 'a Connection'
|
18
18
|
it_should_behave_like 'a Connection via JDNI' if JRUBY
|
19
19
|
it_should_behave_like 'a Connection with JDBC URL support' if JRUBY
|
20
|
+
|
21
|
+
unless JRUBY
|
22
|
+
|
23
|
+
describe 'connecting with busy timeout' do
|
24
|
+
|
25
|
+
it 'connects with a valid timeout' do
|
26
|
+
DataObjects::Connection.new("#{CONFIG.uri}?busy_timeout=200").should_not be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'raises an error when passed an invalid value' do
|
30
|
+
lambda { DataObjects::Connection.new("#{CONFIG.uri}?busy_timeout=stuff") }.
|
31
|
+
should raise_error(ArgumentError)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
20
37
|
end
|
data/tasks/compile.rake
CHANGED
@@ -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.
|
58
|
+
gem.add_dependency 'do_jdbc', '0.10.10'
|
59
59
|
end
|
60
60
|
end
|
61
61
|
rescue LoadError
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 10
|
8
|
-
-
|
9
|
-
version: 0.10.
|
8
|
+
- 10
|
9
|
+
version: 0.10.10
|
10
10
|
platform: x86-mingw32
|
11
11
|
authors:
|
12
12
|
- Dirkjan Bussink
|
@@ -28,8 +28,8 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
- 10
|
31
|
-
-
|
32
|
-
version: 0.10.
|
31
|
+
- 10
|
32
|
+
version: 0.10.10
|
33
33
|
requirement: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
prerelease: false
|