Fixed a few Oracle issues: Allows Oracle's odd date handling to still work consistently within #to_xml, Passes test that hardcode insert statement by dropping the :id column, Updated RUNNING_UNIT_TESTS with Oracle instructions, Corrects method signature for #exec #5294 [schoenm@earthlink.net]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4552 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2006-07-05 02:54:19 +00:00
parent e8504877c0
commit 784165e03b
6 changed files with 26 additions and 6 deletions

@ -1,5 +1,7 @@
*SVN*
* Fixed a few Oracle issues: Allows Oracle's odd date handling to still work consistently within #to_xml, Passes test that hardcode insert statement by dropping the :id column, Updated RUNNING_UNIT_TESTS with Oracle instructions, Corrects method signature for #exec #5294 [schoenm@earthlink.net]
* Added :group to available options for finds done on associations #5516 [mike@michaeldewey.org]
* Minor tweak to improve performance of ActiveRecord::Base#to_param.

@ -44,3 +44,20 @@ This gives a very large speed boost. With rake:
Or, by hand:
AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb
== Testing with Oracle
In order to allow for testing against Oracle using an "arunit" schema within an existing
Oracle database, the database name and tns connection string must be set in environment
variables prior to running the unit tests.
$ export ARUNIT_DB_NAME=MYDB
$ export ARUNIT_DB=MYDB
The ARUNIT_DB_NAME variable should be set to the name by which the database knows
itself, ie., what will be returned by the query:
select sys_context('userenv','db_name') db from dual
And the ARUNIT_DB variable should be set to the tns connection string.

@ -1646,8 +1646,9 @@ def column_for_attribute(name)
def ==(comparison_object)
comparison_object.equal?(self) ||
(comparison_object.instance_of?(self.class) &&
comparison_object.id == id &&
!comparison_object.new_record?)
((!comparison_object.new_record? && comparison_object.id == id) ||
(comparison_object.new_record? && comparison_object.attributes == attributes))
)
end
# Delegates to ==

@ -635,11 +635,11 @@ def reset!
# Adds auto-recovery functionality.
#
# See: http://www.jiubao.org/ruby-oci8/api.en.html#label-11
def exec(sql, *bindvars)
def exec(sql, *bindvars, &block)
should_retry = self.class.auto_retry? && autocommit?
begin
@connection.exec(sql, *bindvars)
@connection.exec(sql, *bindvars, &block)
rescue OCIException => e
raise unless LOST_CONNECTION_ERROR_CODES.include?(e.code)
@active = false

@ -1239,7 +1239,7 @@ def test_to_xml
assert xml.include?(%(<content>Have a nice day</content>))
assert xml.include?(%(<author-email-address>david@loudthinking.com</author-email-address>))
assert xml.match(%(<parent-id type="integer"></parent-id>))
if current_adapter?(:SybaseAdapter) or current_adapter?(:SQLServerAdapter)
if current_adapter?(:SybaseAdapter) or current_adapter?(:SQLServerAdapter) or current_adapter?(:OracleAdapter)
assert xml.include?(%(<last-read type="datetime">#{last_read_in_current_timezone}</last-read>))
else
assert xml.include?(%(<last-read type="date">2004-04-15</last-read>))

@ -170,7 +170,7 @@ def test_add_column_not_null_without_default
end
def test_add_column_not_null_with_default
Person.connection.create_table :testings do |t|
Person.connection.create_table :testings, :id => false do |t|
t.column :foo, :string
end
Person.connection.execute "insert into testings (foo) values ('hello')"