aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/Rakefile2
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb2
-rw-r--r--activerecord/lib/active_record/test_case.rb6
-rw-r--r--activerecord/lib/active_record/version.rb4
-rw-r--r--activerecord/test/cases/adapter_test_sqlserver.rb95
-rw-r--r--activerecord/test/cases/associations/eager_test.rb2
-rwxr-xr-xactiverecord/test/cases/base_test.rb13
-rw-r--r--activerecord/test/cases/binary_test.rb6
-rw-r--r--activerecord/test/cases/defaults_test.rb2
-rw-r--r--activerecord/test/cases/inheritance_test.rb4
-rw-r--r--activerecord/test/cases/locking_test.rb4
-rw-r--r--activerecord/test/cases/migration_test.rb10
-rw-r--r--activerecord/test/cases/table_name_test_sqlserver.rb23
-rw-r--r--activerecord/test/schema/sqlserver_specific_schema.rb5
14 files changed, 21 insertions, 157 deletions
diff --git a/activerecord/Rakefile b/activerecord/Rakefile
index 49c51ecb0c..f47674d5b7 100644
--- a/activerecord/Rakefile
+++ b/activerecord/Rakefile
@@ -171,7 +171,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
- s.add_dependency('activesupport', '= 2.2.1' + PKG_BUILD)
+ s.add_dependency('activesupport', '= 2.3.0' + PKG_BUILD)
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite"
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite"
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index f8fa969dc3..092d8f2268 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -31,7 +31,7 @@ module ActiveRecord
include QueryCache
include ActiveSupport::Callbacks
define_callbacks :checkout, :checkin
- checkout :reset!
+
@@row_even = true
def initialize(connection, logger = nil) #:nodoc:
diff --git a/activerecord/lib/active_record/test_case.rb b/activerecord/lib/active_record/test_case.rb
index d5f43f56e6..149b93203e 100644
--- a/activerecord/lib/active_record/test_case.rb
+++ b/activerecord/lib/active_record/test_case.rb
@@ -3,11 +3,9 @@ require "active_support/test_case"
module ActiveRecord
class TestCase < ActiveSupport::TestCase #:nodoc:
def assert_date_from_db(expected, actual, message = nil)
- # SQL Server doesn't have a separate column type just for dates,
+ # SybaseAdapter doesn't have a separate column type just for dates,
# so the time is in the string and incorrectly formatted
- if current_adapter?(:SQLServerAdapter)
- assert_equal expected.strftime("%Y/%m/%d 00:00:00"), actual.strftime("%Y/%m/%d 00:00:00")
- elsif current_adapter?(:SybaseAdapter)
+ if current_adapter?(:SybaseAdapter)
assert_equal expected.to_s, actual.to_date.to_s, message
else
assert_equal expected.to_s, actual.to_s, message
diff --git a/activerecord/lib/active_record/version.rb b/activerecord/lib/active_record/version.rb
index 3c5a9b7df8..6ac4bdc905 100644
--- a/activerecord/lib/active_record/version.rb
+++ b/activerecord/lib/active_record/version.rb
@@ -1,8 +1,8 @@
module ActiveRecord
module VERSION #:nodoc:
MAJOR = 2
- MINOR = 2
- TINY = 1
+ MINOR = 3
+ TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff --git a/activerecord/test/cases/adapter_test_sqlserver.rb b/activerecord/test/cases/adapter_test_sqlserver.rb
deleted file mode 100644
index ea270fb7ee..0000000000
--- a/activerecord/test/cases/adapter_test_sqlserver.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-require "cases/helper"
-require 'models/default'
-require 'models/post'
-require 'models/task'
-
-class SqlServerAdapterTest < ActiveRecord::TestCase
- class TableWithRealColumn < ActiveRecord::Base; end
-
- fixtures :posts, :tasks
-
- def setup
- @connection = ActiveRecord::Base.connection
- end
-
- def teardown
- @connection.execute("SET LANGUAGE us_english") rescue nil
- end
-
- def test_real_column_has_float_type
- assert_equal :float, TableWithRealColumn.columns_hash["real_number"].type
- end
-
- # SQL Server 2000 has a bug where some unambiguous date formats are not
- # correctly identified if the session language is set to german
- def test_date_insertion_when_language_is_german
- @connection.execute("SET LANGUAGE deutsch")
-
- assert_nothing_raised do
- Task.create(:starting => Time.utc(2000, 1, 31, 5, 42, 0), :ending => Date.new(2006, 12, 31))
- end
- end
-
- def test_indexes_with_descending_order
- # Make sure we have an index with descending order
- @connection.execute "CREATE INDEX idx_credit_limit ON accounts (credit_limit DESC)" rescue nil
- assert_equal ["credit_limit"], @connection.indexes('accounts').first.columns
- ensure
- @connection.execute "DROP INDEX accounts.idx_credit_limit"
- end
-
- def test_execute_without_block_closes_statement
- assert_all_statements_used_are_closed do
- @connection.execute("SELECT 1")
- end
- end
-
- def test_execute_with_block_closes_statement
- assert_all_statements_used_are_closed do
- @connection.execute("SELECT 1") do |sth|
- assert !sth.finished?, "Statement should still be alive within block"
- end
- end
- end
-
- def test_insert_with_identity_closes_statement
- assert_all_statements_used_are_closed do
- @connection.insert("INSERT INTO accounts ([id], [firm_id],[credit_limit]) values (999, 1, 50)")
- end
- end
-
- def test_insert_without_identity_closes_statement
- assert_all_statements_used_are_closed do
- @connection.insert("INSERT INTO accounts ([firm_id],[credit_limit]) values (1, 50)")
- end
- end
-
- def test_active_closes_statement
- assert_all_statements_used_are_closed do
- @connection.active?
- end
- end
-
- def assert_all_statements_used_are_closed(&block)
- existing_handles = []
- ObjectSpace.each_object(DBI::StatementHandle) {|handle| existing_handles << handle}
- GC.disable
-
- yield
-
- used_handles = []
- ObjectSpace.each_object(DBI::StatementHandle) {|handle| used_handles << handle unless existing_handles.include? handle}
-
- assert_block "No statements were used within given block" do
- used_handles.size > 0
- end
-
- ObjectSpace.each_object(DBI::StatementHandle) do |handle|
- assert_block "Statement should have been closed within given block" do
- handle.finished?
- end
- end
- ensure
- GC.enable
- end
-end
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 5f43975d5a..a4f1f65f9a 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -667,7 +667,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
end
def test_count_with_include
- if current_adapter?(:SQLServerAdapter, :SybaseAdapter)
+ if current_adapter?(:SybaseAdapter)
assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "len(comments.body) > 15")
elsif current_adapter?(:OpenBaseAdapter)
assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "length(FETCHBLOB(comments.body)) > 15")
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index da9f2742d8..5f54931d00 100755
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -428,9 +428,6 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_preserving_date_objects
- # SQL Server doesn't have a separate column type just for dates, so all are returned as time
- return true if current_adapter?(:SQLServerAdapter)
-
if current_adapter?(:SybaseAdapter, :OracleAdapter)
# Sybase ctlib does not (yet?) support the date type; use datetime instead.
# Oracle treats all dates/times as Time.
@@ -777,8 +774,8 @@ class BasicsTest < ActiveRecord::TestCase
end
end
- # Oracle, SQLServer, and Sybase do not have a TIME datatype.
- unless current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
+ # Oracle, and Sybase do not have a TIME datatype.
+ unless current_adapter?(:OracleAdapter, :SybaseAdapter)
def test_utc_as_time_zone
Topic.default_timezone = :utc
attributes = { "bonus_time" => "5:42:00AM" }
@@ -1157,8 +1154,8 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_attributes_on_dummy_time
- # Oracle, SQL Server, and Sybase do not have a TIME datatype.
- return true if current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
+ # Oracle, and Sybase do not have a TIME datatype.
+ return true if current_adapter?(:OracleAdapter, :SybaseAdapter)
attributes = {
"bonus_time" => "5:42:00AM"
@@ -1874,7 +1871,7 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal "integer", xml.elements["//parent-id"].attributes['type']
assert_equal "true", xml.elements["//parent-id"].attributes['nil']
- if current_adapter?(:SybaseAdapter, :SQLServerAdapter, :OracleAdapter)
+ if current_adapter?(:SybaseAdapter, :OracleAdapter)
assert_equal last_read_in_current_timezone, xml.elements["//last-read"].text
assert_equal "datetime" , xml.elements["//last-read"].attributes['type']
else
diff --git a/activerecord/test/cases/binary_test.rb b/activerecord/test/cases/binary_test.rb
index 7131532c05..8545ba97cc 100644
--- a/activerecord/test/cases/binary_test.rb
+++ b/activerecord/test/cases/binary_test.rb
@@ -1,13 +1,9 @@
require "cases/helper"
# Without using prepared statements, it makes no sense to test
-# BLOB data with SQL Server, because the length of a statement is
-# limited to 8KB.
-#
-# Without using prepared statements, it makes no sense to test
# BLOB data with DB2 or Firebird, because the length of a statement
# is limited to 32KB.
-unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :DB2Adapter, :FirebirdAdapter)
+unless current_adapter?(:SybaseAdapter, :DB2Adapter, :FirebirdAdapter)
require 'models/binary'
class BinaryTest < ActiveRecord::TestCase
diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb
index ee84cb8af8..38e4853dc0 100644
--- a/activerecord/test/cases/defaults_test.rb
+++ b/activerecord/test/cases/defaults_test.rb
@@ -78,7 +78,7 @@ class DefaultTest < ActiveRecord::TestCase
end
end
- if current_adapter?(:PostgreSQLAdapter, :SQLServerAdapter, :FirebirdAdapter, :OpenBaseAdapter, :OracleAdapter)
+ if current_adapter?(:PostgreSQLAdapter, :FirebirdAdapter, :OpenBaseAdapter, :OracleAdapter)
def test_default_integers
default = Default.new
assert_instance_of Fixnum, default.positive_integer
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index a39415618d..3f59eb9706 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -59,13 +59,13 @@ class InheritanceTest < ActiveRecord::TestCase
def test_a_bad_type_column
#SQLServer need to turn Identity Insert On before manually inserting into the Identity column
- if current_adapter?(:SQLServerAdapter, :SybaseAdapter)
+ if current_adapter?(:SybaseAdapter)
Company.connection.execute "SET IDENTITY_INSERT companies ON"
end
Company.connection.insert "INSERT INTO companies (id, #{QUOTED_TYPE}, name) VALUES(100, 'bad_class!', 'Not happening')"
#We then need to turn it back Off before continuing.
- if current_adapter?(:SQLServerAdapter, :SybaseAdapter)
+ if current_adapter?(:SybaseAdapter)
Company.connection.execute "SET IDENTITY_INSERT companies OFF"
end
assert_raises(ActiveRecord::SubclassNotFound) { Company.find(100) }
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb
index 0a14b1d906..077cac7747 100644
--- a/activerecord/test/cases/locking_test.rb
+++ b/activerecord/test/cases/locking_test.rb
@@ -200,9 +200,9 @@ end
# blocks, so separate script called by Kernel#system is needed.
# (See exec vs. async_exec in the PostgreSQL adapter.)
-# TODO: The SQL Server, Sybase, and OpenBase adapters currently have no support for pessimistic locking
+# TODO: The Sybase, and OpenBase adapters currently have no support for pessimistic locking
-unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :OpenBaseAdapter)
+unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter)
class PessimisticLockingTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false
fixtures :people, :readers
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index ac44dd7ffe..2ec3d40332 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -271,9 +271,9 @@ if ActiveRecord::Base.connection.supports_migrations?
Person.connection.drop_table table_name rescue nil
end
- # SQL Server, Sybase, and SQLite3 will not allow you to add a NOT NULL
+ # Sybase, and SQLite3 will not allow you to add a NOT NULL
# column to a table without a default value.
- unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :SQLiteAdapter)
+ unless current_adapter?(:SybaseAdapter, :SQLiteAdapter)
def test_add_column_not_null_without_default
Person.connection.create_table :testings do |t|
t.column :foo, :string
@@ -410,7 +410,7 @@ if ActiveRecord::Base.connection.supports_migrations?
assert_equal Fixnum, bob.age.class
assert_equal Time, bob.birthday.class
- if current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
+ if current_adapter?(:OracleAdapter, :SybaseAdapter)
# Sybase, and Oracle don't differentiate between date/time
assert_equal Time, bob.favorite_day.class
else
@@ -851,10 +851,6 @@ if ActiveRecord::Base.connection.supports_migrations?
# - SQLite3 stores a float, in violation of SQL
assert_kind_of BigDecimal, b.value_of_e
assert_equal BigDecimal("2.71828182845905"), b.value_of_e
- elsif current_adapter?(:SQLServer)
- # - SQL Server rounds instead of truncating
- assert_kind_of Fixnum, b.value_of_e
- assert_equal 3, b.value_of_e
else
# - SQL standard is an integer
assert_kind_of Fixnum, b.value_of_e
diff --git a/activerecord/test/cases/table_name_test_sqlserver.rb b/activerecord/test/cases/table_name_test_sqlserver.rb
deleted file mode 100644
index fbf38a130e..0000000000
--- a/activerecord/test/cases/table_name_test_sqlserver.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require "cases/helper"
-require 'active_record/schema'
-
-if ActiveRecord::Base.connection.supports_migrations?
- class Order < ActiveRecord::Base
- self.table_name = '[order]'
- end
-
- class TableNameTest < ActiveRecord::TestCase
- self.use_transactional_fixtures = false
-
- # Ensures Model.columns works when using SQLServer escape characters.
- # Enables legacy schemas using SQL reserved words as table names.
- # Should work with table names with spaces as well ('table name').
- def test_escaped_table_name
- assert_nothing_raised do
- ActiveRecord::Base.connection.select_all 'SELECT * FROM [order]'
- end
- assert_equal '[order]', Order.table_name
- assert_equal 5, Order.columns.length
- end
- end
-end
diff --git a/activerecord/test/schema/sqlserver_specific_schema.rb b/activerecord/test/schema/sqlserver_specific_schema.rb
deleted file mode 100644
index cd8aca2fe5..0000000000
--- a/activerecord/test/schema/sqlserver_specific_schema.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-ActiveRecord::Schema.define do
- create_table :table_with_real_columns, :force => true do |t|
- t.column :real_number, :real
- end
-end \ No newline at end of file