From d606f9ceac86759c806801a51914f4d88ad88156 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Sat, 13 Jan 2007 18:25:29 +0000 Subject: db.transaction should properly catch an exception (closes #3981) --- lib/sqlite3/database.rb | 2 +- test/mocks.rb | 3 +++ test/tc_integration.rb | 5 ++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/sqlite3/database.rb b/lib/sqlite3/database.rb index f126004..3be3109 100644 --- a/lib/sqlite3/database.rb +++ b/lib/sqlite3/database.rb @@ -591,7 +591,7 @@ module SQLite3 abort = false begin yield self - rescue Exception + rescue ::Object abort = true raise ensure diff --git a/test/mocks.rb b/test/mocks.rb index 6843e52..4a1d753 100644 --- a/test/mocks.rb +++ b/test/mocks.rb @@ -30,6 +30,9 @@ # ============================================================================= #++ +require 'rubygems' +gem 'flexmock', '< 0.1.0' + require 'flexmock' class FlexMockWithArgs < FlexMock diff --git a/test/tc_integration.rb b/test/tc_integration.rb index 864fe85..74b18c8 100644 --- a/test/tc_integration.rb +++ b/test/tc_integration.rb @@ -7,9 +7,8 @@ require 'sqlite3/database' class String def to_utf16(terminate=false) - result = "" - self.split(//).map { |c| c[0] }.pack("s*") - result + (terminate ? "\0\0" : "") + self.split(//).map { |c| c[0] }.pack("v*") + + (terminate ? "\0\0" : "") end def from_utf16 -- cgit