Permalink
Browse files

Add Oracle support for CLOB inserts. Closes #4748. [schoenm@earthlink…

….net sandra.metz@duke.edu]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4280 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 8df0dad commit 242cd0604e6a4fec691004beb950cf4261ba7f3c Marcel Molina committed Apr 26, 2006
Showing with 5 additions and 3 deletions.
  1. +2 −0 activerecord/CHANGELOG
  2. +3 −3 activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Add Oracle support for CLOB inserts. Closes #4748. [schoenm@earthlink.net sandra.metz@duke.edu]
+
* Various fixes for sqlserver_adapter (odbc statement finishing, ado schema dumper, drop index). Closes #4831. [kajism@yahoo.com]
* Add support for :order option to with_scope. Closes #3887. [eric.daspet@survol.net]
@@ -58,11 +58,11 @@ def attributes_with_quotes(include_primary_key = true) #:nodoc:
after_save :write_lobs
def write_lobs() #:nodoc:
if connection.is_a?(ConnectionAdapters::OracleAdapter)
- self.class.columns.select { |c| c.type == :binary }.each { |c|
+ self.class.columns.select { |c| c.sql_type =~ /LOB$/i }.each { |c|
value = self[c.name]
next if value.nil? || (value == '')
lob = connection.select_one(
- "SELECT #{ c.name} FROM #{ self.class.table_name } WHERE #{ self.class.primary_key} = #{quote(id)}",
+ "SELECT #{c.name} FROM #{self.class.table_name} WHERE #{self.class.primary_key} = #{quote(id)}",
'Writable Large Object')[c.name]
lob.write value
}
@@ -210,7 +210,7 @@ def quote_string(string) #:nodoc:
end
def quote(value, column = nil) #:nodoc:
- if column && column.type == :binary
+ if column && column.sql_type =~ /LOB$/i
%Q{empty_#{ column.sql_type rescue 'blob' }()}
else
case value

0 comments on commit 242cd06

Please sign in to comment.