Skip to content
Browse files

Merge oracle fixes over to 1.2

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5959 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 517628d commit d25ae9b6e1a20f4f2c10b8a70478423b3e7980a6 @NZKoz NZKoz committed Jan 16, 2007
View
2 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -265,7 +265,7 @@ def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
column_type_sql << "(#{precision})"
end
else
- raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specifed" if scale
+ raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specified" if scale
end
column_type_sql
else
View
6 activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
@@ -66,7 +66,6 @@ module ConnectionAdapters #:nodoc:
class OracleColumn < Column #:nodoc:
def type_cast(value)
- return nil if value =~ /^\s*null\s*$/i
return guess_date_or_time(value) if type == :datetime && OracleAdapter.emulate_dates
super
end
@@ -676,13 +675,14 @@ def exec(sql, *bindvars, &block)
# OCI8 driver is unavailable.
module ActiveRecord # :nodoc:
class Base
+ @@oracle_error_message = "Oracle/OCI libraries could not be loaded: #{$!.to_s}"
def self.oracle_connection(config) # :nodoc:
# Set up a reasonable error message
- raise LoadError, "Oracle/OCI libraries could not be loaded."
+ raise LoadError, @@oracle_error_message
end
def self.oci_connection(config) # :nodoc:
# Set up a reasonable error message
- raise LoadError, "Oracle/OCI libraries could not be loaded."
+ raise LoadError, @@oracle_error_message
end
end
end
View
11 activerecord/test/base_test.rb
@@ -69,7 +69,7 @@ def test_set_attributes
assert_equal("Jason", topic.author_name)
assert_equal(topics(:first).author_email_address, Topic.find(1).author_email_address)
end
-
+
def test_integers_as_nil
test = AutoId.create('value' => '')
assert_nil AutoId.find(test.id).value
@@ -156,6 +156,15 @@ def test_save!
reply = Reply.new
assert_raise(ActiveRecord::RecordInvalid) { reply.save! }
end
+
+ def test_save_null_string_attributes
+ topic = Topic.find(1)
+ topic.attributes = { "title" => "null", "author_name" => "null" }
+ topic.save!
+ topic.reload
+ assert_equal("null", topic.title)
+ assert_equal("null", topic.author_name)
+ end
def test_hashes_not_mangled
new_topic = { :title => "New Topic" }

0 comments on commit d25ae9b

Please sign in to comment.
Something went wrong with that request. Please try again.