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:
parent
e981eaaf34
commit
885c11b8f9
4 changed files with 18 additions and 4 deletions
|
@ -66,6 +66,12 @@ module ActiveRecord
|
|||
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
|
||||
# is called before each insert to set the record's primary key.
|
||||
|
|
|
@ -206,6 +206,10 @@ module ActiveRecord
|
|||
true
|
||||
end
|
||||
|
||||
def supports_savepoints? #:nodoc:
|
||||
true
|
||||
end
|
||||
|
||||
def native_database_types #:nodoc:
|
||||
NATIVE_DATABASE_TYPES
|
||||
end
|
||||
|
|
|
@ -273,6 +273,10 @@ module ActiveRecord
|
|||
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.
|
||||
def table_alias_length
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue