Looks like it uncovered a bug in the Oracle adapter.

On 09/03/2007, at 2:29 PM, Michael Schoen wrote:

>
> "bitsweat" has kicked AR/Oracle while it was down...
>
> http://dev.rubyonrails.org/changeset/6364
> ---------------------------------------------------------------------- 
> --
> r6364 | bitsweat | 2007-03-08 19:23:37 -0800 (Thu, 08 Mar 2007) | 1  
> line
>
> Consistently quote primary key column names. Closes #7763.
> ---------------------------------------------------------------------- 
> --
>
>   1) Failure:
> test_native_types(MigrationTest)
>     [./test/migration_test.rb:307:in `test_native_types'
>      /usr/pkg/ruby184/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/ 
> test_case_adapter.rb:19:in `run']:
> <Rational(-1, 3)> expected but was
> <0>.

no idea what that's from. That was failing before this commit, yeah?

>   2) Failure:
> test_update_counters_should_quote_pkey_and_quote_counter_columns 
> (PrimaryKeysTest)
>     [./test/pk_test.rb:87:in  
> `test_update_counters_should_quote_pkey_and_quote_counter_columns'
>      /usr/pkg/ruby184/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/ 
> test_case_adapter.rb:19:in `run']:
> Exception raised:
> Class: <ActiveRecord::StatementInvalid>
> Message: <"OCIError: ORA-00904: \"FLEACOUNT\": invalid identifier:  
> UPDATE mixed_case_monkeys SET fleaCount = fleaCount + 99 WHERE  
> (\"monkeyID\" = 1) ">

Looks like the Oracle adapter method doesn't like symbols, but core  
expects to be able to pass them (OracleAdapter, L164):

         def quote_column_name(name) #:nodoc:
           name =~ /[A-Z]/ ? "\"#{name}\"" : name
         end

needs a "to_s" on the name comparison:

         def quote_column_name(name) #:nodoc:
           name.to_s =~ /[A-Z]/ ? "\"#{name}\"" : name
         end

Here's an AdapterTestOracle you might wanna add to ensure things do  
what they're meant to do:

require 'abstract_unit'
class AdapterTestOracle < Test::Unit::TestCase
   def setup
     @connection = ActiveRecord::Base.connection
   end
   def test_should_quote_string_mixed_case_column_names
     assert_equal %("mixedCase"), @connection.quote_column_name 
("mixedCase")
   end
   def test_should_quote_symbol_mixed_case_column_names
     assert_equal %("mixedCase"), @connection.quote_column_name 
(:mixedCase)
   end
end

Want me to submit another patch for this bug? I can't actually test  
Oracle though...

-- tim


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to