Just in case somebody is facing this issue as well...

It seems that ActiveRecord is not handling oracle nvarchar2 column
types correctly.


If somebody is facing my issue: Please find beloa the code for a fix
Many thanks to the oci adapter engineer who did the main work for it.

module ActiveRecord
  module ConnectionAdapters #:nodoc:
    class OracleColumn < Column #:nodoc:
      attr_reader :nchar
      def initialize(name, default, sql_type, null)
        super
        @nchar = (@type == :string && sql_type[0,1] == 'N')
      end
    end

    class OracleAdapter < AbstractAdapter
      def quote(value, column = nil) #:nodoc:
        if value && column && [:text, :binary].include?(column.type)
          %Q{empty_#{ column.sql_type.downcase rescue 'blob' }()}
        elsif value && column && column.nchar
          'N' + super
        else
          super
        end
      end
    end
  end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to