Permalink
Browse files

Make SQLite3 pass the unit tests for savepoints.

  • Loading branch information...
1 parent e981eaa commit 885c11b8f9e18f34b12076023455e72166365f00 @FooBarWidget FooBarWidget committed Oct 9, 2008
@@ -65,6 +65,12 @@ def supports_count_distinct?
def supports_ddl_transactions?
false
end
+
+ # Does this adapter support savepoints? PostgreSQL and MySQL do, SQLite
+ # does not.
+ def supports_savepoints?
+ false
+ end
# Should primary key values be selected from their corresponding
# sequence before the insert statement? If true, next_sequence_value
@@ -205,6 +205,10 @@ def adapter_name #:nodoc:
def supports_migrations? #:nodoc:
true
end
+
+ def supports_savepoints? #:nodoc:
+ true
+ end
def native_database_types #:nodoc:
NATIVE_DATABASE_TYPES
@@ -272,6 +272,10 @@ def supports_insert_with_returning?
def supports_ddl_transactions?
true
end
+
+ def supports_savepoints?
+ true
+ end
# Returns the configured supported identifier length supported by PostgreSQL,
# or report the default of 63 on PostgreSQL 7.x.
@@ -239,7 +239,7 @@ def test_force_savepoint_in_nested_transaction
assert @first.reload.approved?
assert !@second.reload.approved?
- end
+ end if Topic.connection.supports_savepoints?
def test_no_savepoint_in_nested_transaction_without_force
Topic.transaction do
@@ -260,7 +260,7 @@ def test_no_savepoint_in_nested_transaction_without_force
assert !@first.reload.approved?
assert !@second.reload.approved?
- end
+ end if Topic.connection.supports_savepoints?
def test_many_savepoints
Topic.transaction do
@@ -304,7 +304,7 @@ def test_many_savepoints
assert_equal "One", @one
assert_equal "Two", @two
assert_equal "Three", @three
- end
+ end if Topic.connection.supports_savepoints?
uses_mocha 'mocking connection.commit_db_transaction' do
def test_rollback_when_commit_raises
@@ -411,7 +411,7 @@ def test_no_automatic_savepoint_for_inner_transaction
assert !@first.reload.approved?
end
-end
+end if Topic.connection.supports_savepoints?
if current_adapter?(:PostgreSQLAdapter)
class ConcurrentTransactionTest < TransactionTest

0 comments on commit 885c11b

Please sign in to comment.