diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-12-08 04:21:38 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-12-08 04:21:38 +0000 |
commit | bae97ef4830e128826c215298d6d92a97ff1e136 (patch) | |
tree | 99f4400f322be85cbd1aa3ff4cf7c11266900f44 /activerecord | |
parent | 9d88348e2ef367bcca612b2b5fba5e7189e2db20 (diff) | |
download | rails-bae97ef4830e128826c215298d6d92a97ff1e136.tar.gz rails-bae97ef4830e128826c215298d6d92a97ff1e136.tar.bz2 rails-bae97ef4830e128826c215298d6d92a97ff1e136.zip |
Oracle: use syntax compatible with Oracle 8. References #3131.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/oci_adapter.rb | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index f5c6f84ae8..e64cebc782 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Oracle: use syntax compatible with Oracle 8. #3131 [Michael Schoen] + * MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat. Eliminate usage of mysql.ping because it doesn't guarantee reconnect. Explicitly close and reopen the connection instead. [Jeremy Kemper] * Added preliminary support for polymorphic associations [DHH] diff --git a/activerecord/lib/active_record/connection_adapters/oci_adapter.rb b/activerecord/lib/active_record/connection_adapters/oci_adapter.rb index 1580dcac85..fa788b99fc 100644 --- a/activerecord/lib/active_record/connection_adapters/oci_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/oci_adapter.rb @@ -339,11 +339,10 @@ begin table_cols = %Q{ select column_name, data_type, data_default, nullable, - case when data_type = 'NUMBER' then data_precision - when data_type = 'VARCHAR2' then data_length - else null end as length, - case when data_type = 'NUMBER' then data_scale - else null end as scale + decode(data_type, 'NUMBER', data_precision, + 'VARCHAR2', data_length, + null) as length, + decode(data_type, 'NUMBER', data_scale, null) as scale from #{scope}_catalog cat, #{scope}_synonyms syn, all_tab_columns col where cat.table_name = #{table} and syn.synonym_name (+)= cat.table_name @@ -515,7 +514,7 @@ begin def new_connection(username, password, host) conn = OCI8.new username, password, host conn.exec %q{alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'} - conn.exec %q{alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'} + conn.exec %q{alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'} rescue nil conn.autocommit = true conn end |