diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-16 03:20:46 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-16 03:20:46 +0000 |
commit | 9b9a0908e5a834d981bd095099d9cefc3abdb226 (patch) | |
tree | d044e9958759e4b67704c1000c166831b91028b8 /activerecord/lib/active_record/connection_adapters | |
parent | 275ea6de499c009e51fbe4c1abcfa4f50bdfeb12 (diff) | |
download | rails-9b9a0908e5a834d981bd095099d9cefc3abdb226.tar.gz rails-9b9a0908e5a834d981bd095099d9cefc3abdb226.tar.bz2 rails-9b9a0908e5a834d981bd095099d9cefc3abdb226.zip |
Oracle adapter gets some love #4230 [schoenm@earthlink.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3889 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/oracle_adapter.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb index 7489fac327..3291fac455 100644 --- a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb @@ -108,7 +108,8 @@ begin when /char/i : :string when /num|float|double|dec|real|int/i : @scale == 0 ? :integer : :float when /date|time/i : @name =~ /_at$/ ? :time : :datetime - when /lob/i : :binary + when /clob/i : :text + when /blob/i : :binary end end @@ -178,7 +179,7 @@ begin { :primary_key => "NUMBER(38) NOT NULL PRIMARY KEY", :string => { :name => "VARCHAR2", :limit => 255 }, - :text => { :name => "BLOB" }, + :text => { :name => "CLOB" }, :integer => { :name => "NUMBER", :limit => 38 }, :float => { :name => "NUMBER" }, :datetime => { :name => "DATE" }, @@ -316,6 +317,10 @@ begin # # see: abstract/schema_statements.rb + def current_database #:nodoc: + select_one("select sys_context('userenv','db_name') db from dual")["db"] + end + def tables(name = nil) #:nodoc: select_all("select lower(table_name) from user_tables").inject([]) do | tabs, t | tabs << t.to_a.first.last @@ -368,8 +373,8 @@ begin oracle_downcase(row['column_name']), row['data_default'], row['data_type'], - row['length'].to_i, - row['scale'].to_i, + (l = row['length']).nil? ? nil : l.to_i, + (s = row['scale']).nil? ? nil : s.to_i, row['nullable'] == 'Y' ) end @@ -509,6 +514,12 @@ begin case do_ocicall(@ctx) { @parms[i - 1].attrGet(OCI_ATTR_DATA_TYPE) } when 8 : @stmt.defineByPos(i, String, 65535) # Read LONG values when 187 : @stmt.defineByPos(i, OraDate) # Read TIMESTAMP values + when 108 + if @parms[i - 1].attrGet(OCI_ATTR_TYPE_NAME) == 'XMLTYPE' + @stmt.defineByPos(i, String, 65535) + else + raise 'unsupported datatype' + end else define_a_column_pre_ar i end end |