amalgalite 0.7.5-x86-mswin32-60 → 0.7.6-x86-mswin32-60
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/HISTORY +12 -0
- data/ext/amalgalite3_database.c +2 -2
- data/ext/amalgalite3_statement.c +15 -4
- data/ext/sqlite3.c +4430 -2733
- data/ext/sqlite3.h +226 -24
- data/ext/test_error.c +22 -37
- data/lib/amalgalite/database.rb +3 -1
- data/lib/amalgalite/statement.rb +16 -3
- data/lib/amalgalite/version.rb +1 -1
- data/lib/amalgalite3.so +0 -0
- data/spec/aggregate_spec.rb +2 -1
- data/spec/busy_handler.rb +2 -1
- data/spec/database_spec.rb +30 -0
- data/spec/progress_handler_spec.rb +3 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/sqlite3/version_spec.rb +2 -2
- data/spec/statement_spec.rb +2 -1
- data/tasks/config.rb +2 -2
- data/tasks/rspec.rake +1 -1
- metadata +2 -2
data/lib/amalgalite/statement.rb
CHANGED
@@ -35,6 +35,14 @@ module Amalgalite
|
|
35
35
|
@blobs_to_write = []
|
36
36
|
@rowid_index = nil
|
37
37
|
@result_meta = nil
|
38
|
+
@open = true
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# is the statement open for business
|
43
|
+
#
|
44
|
+
def open?
|
45
|
+
@open
|
38
46
|
end
|
39
47
|
|
40
48
|
##
|
@@ -288,8 +296,10 @@ module Amalgalite
|
|
288
296
|
row = nil
|
289
297
|
write_blobs
|
290
298
|
else
|
291
|
-
|
292
|
-
|
299
|
+
self.close # must close so that the error message is guaranteed to be pushed into the database handler
|
300
|
+
# and we can can call last_error_message on it
|
301
|
+
msg = "SQLITE ERROR #{rc} (#{Amalgalite::SQLite3::Constants::ResultCode.name_from_value( rc )}) : #{@db.api.last_error_message}"
|
302
|
+
raise Amalgalite::SQLite3::Error, msg
|
293
303
|
end
|
294
304
|
return row
|
295
305
|
end
|
@@ -396,7 +406,10 @@ module Amalgalite
|
|
396
406
|
# has been closed.
|
397
407
|
#
|
398
408
|
def close
|
399
|
-
|
409
|
+
if open?
|
410
|
+
@stmt_api.close
|
411
|
+
@open = false
|
412
|
+
end
|
400
413
|
end
|
401
414
|
end
|
402
415
|
end
|
data/lib/amalgalite/version.rb
CHANGED
data/lib/amalgalite3.so
CHANGED
Binary file
|
data/spec/aggregate_spec.rb
CHANGED
data/spec/busy_handler.rb
CHANGED
data/spec/database_spec.rb
CHANGED
@@ -240,6 +240,36 @@ describe Amalgalite::Database do
|
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
+
it "commits if an exception happens during a transaction block but is rescued within the block" do
|
244
|
+
@iso_db.transaction do |db|
|
245
|
+
begin
|
246
|
+
r = db.execute("SELECT count(1) as cnt FROM country");
|
247
|
+
r.first['cnt'].should eql(242)
|
248
|
+
db.execute("DELETE FROM country")
|
249
|
+
db.in_transaction?.should eql(true)
|
250
|
+
raise "testing rollback"
|
251
|
+
rescue => e
|
252
|
+
e.message.should == "testing rollback"
|
253
|
+
end
|
254
|
+
$!.should == nil
|
255
|
+
end
|
256
|
+
@iso_db.in_transaction?.should eql(false)
|
257
|
+
@iso_db.first_value_from("select count(1) as cnt from country").should eql(0)
|
258
|
+
end
|
259
|
+
|
260
|
+
it "does not reraise an exception that exits before the transaction starts" do
|
261
|
+
class MyExceptionTest < RuntimeError; end
|
262
|
+
db = Amalgalite::Database.new( ":memory:" )
|
263
|
+
|
264
|
+
lambda {
|
265
|
+
begin
|
266
|
+
raise MyExceptionTest, "James pointed this out"
|
267
|
+
rescue MyExceptionTest
|
268
|
+
db.transaction("EXCLUSIVE") { }
|
269
|
+
end
|
270
|
+
}.should_not raise_error( MyExceptionTest )
|
271
|
+
end
|
272
|
+
|
243
273
|
describe "#define_function" do
|
244
274
|
it "does not allow mixing of arbitrary and mandatory arguments to an SQL function" do
|
245
275
|
class FunctionTest2 < ::Amalgalite::Function
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'spec'
|
3
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), "spec_helper.rb" ) )
|
3
4
|
|
4
|
-
$: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
|
5
5
|
require 'amalgalite'
|
6
6
|
require 'amalgalite/database'
|
7
7
|
class PH < ::Amalgalite::ProgressHandler
|
@@ -82,6 +82,8 @@ describe "Progress Handlers" do
|
|
82
82
|
qt.join
|
83
83
|
ph.call_count.should eql(25)
|
84
84
|
qt[:exception].should be_instance_of( ::Amalgalite::SQLite3::Error )
|
85
|
+
@iso_db.api.last_error_code.should == 9
|
86
|
+
@iso_db.api.last_error_message.should =~ /interrupted/
|
85
87
|
qt[:exception].message.should =~ /interrupted/
|
86
88
|
end
|
87
89
|
|
data/spec/spec_helper.rb
CHANGED
@@ -5,10 +5,10 @@ describe "Amalgalite::SQLite3::Version" do
|
|
5
5
|
it "should have the sqlite3 version" do
|
6
6
|
Amalgalite::SQLite3::VERSION.should =~ /\d\.\d\.\d/
|
7
7
|
Amalgalite::SQLite3::Version.to_s.should =~ /\d\.\d\.\d/
|
8
|
-
Amalgalite::SQLite3::Version.to_i.should eql(
|
8
|
+
Amalgalite::SQLite3::Version.to_i.should eql(3006011)
|
9
9
|
Amalgalite::SQLite3::Version::MAJOR.should eql(3)
|
10
10
|
Amalgalite::SQLite3::Version::MINOR.should eql(6)
|
11
|
-
Amalgalite::SQLite3::Version::RELEASE.should eql(
|
11
|
+
Amalgalite::SQLite3::Version::RELEASE.should eql(11)
|
12
12
|
Amalgalite::SQLite3::Version.to_a.should have(3).items
|
13
13
|
end
|
14
14
|
end
|
data/spec/statement_spec.rb
CHANGED
data/tasks/config.rb
CHANGED
@@ -62,7 +62,7 @@ Configuration.for('test') {
|
|
62
62
|
mode "spec"
|
63
63
|
files Configuration.for("packaging").files.test
|
64
64
|
options %w[ --format progress --color ]
|
65
|
-
ruby_opts %w[
|
65
|
+
ruby_opts %w[ ]
|
66
66
|
}
|
67
67
|
|
68
68
|
#-----------------------------------------------------------------------
|
@@ -72,7 +72,7 @@ Configuration.for('rcov') {
|
|
72
72
|
output_dir "coverage"
|
73
73
|
libs %w[ lib ]
|
74
74
|
rcov_opts %w[ --html ]
|
75
|
-
ruby_opts %w[
|
75
|
+
ruby_opts %w[ ]
|
76
76
|
test_files Configuration.for('packaging').files.test
|
77
77
|
}
|
78
78
|
#
|
data/tasks/rspec.rake
CHANGED
@@ -18,7 +18,7 @@ if spec_config = Configuration.for_if_exist?("test") then
|
|
18
18
|
Amalgalite::Paths.root_dir ]
|
19
19
|
r.spec_files = spec_config.files
|
20
20
|
r.spec_opts = spec_config.options
|
21
|
-
r.warning = true
|
21
|
+
#r.warning = true
|
22
22
|
|
23
23
|
if rcov_config = Configuration.for_if_exist?('rcov') then
|
24
24
|
r.rcov = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amalgalite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02
|
12
|
+
date: 2009-03-02 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|