1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make SQLite3 pass the unit tests for savepoints.

This commit is contained in:
Hongli Lai (Phusion) 2008-10-09 15:41:56 +02:00
parent e981eaaf34
commit 885c11b8f9
4 changed files with 18 additions and 4 deletions

View file

@ -65,6 +65,12 @@ module ActiveRecord
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

View file

@ -205,6 +205,10 @@ module ActiveRecord
def supports_migrations? #:nodoc:
true
end
def supports_savepoints? #:nodoc:
true
end
def native_database_types #:nodoc:
NATIVE_DATABASE_TYPES

View file

@ -272,6 +272,10 @@ module ActiveRecord
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.

View file

@ -239,7 +239,7 @@ class TransactionTest < ActiveRecord::TestCase
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 @@ class TransactionTest < ActiveRecord::TestCase
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 @@ class TransactionTest < ActiveRecord::TestCase
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 @@ class TransactionsWithTransactionalFixturesTest < ActiveRecord::TestCase
assert !@first.reload.approved?
end
end
end if Topic.connection.supports_savepoints?
if current_adapter?(:PostgreSQLAdapter)
class ConcurrentTransactionTest < TransactionTest