diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-27 08:18:41 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-27 08:18:41 +0000 |
commit | beff664f2a036c91e266e2ad867f3d1ed8d716c8 (patch) | |
tree | a175c7bc0ed6affea55d1595577a2c37e38c74e0 /activerecord/lib | |
parent | f15819e8f0cece48ccd5117a37cf6d37374d1bb1 (diff) | |
download | rails-beff664f2a036c91e266e2ad867f3d1ed8d716c8.tar.gz rails-beff664f2a036c91e266e2ad867f3d1ed8d716c8.tar.bz2 rails-beff664f2a036c91e266e2ad867f3d1ed8d716c8.zip |
Refactor DB exceptions and deal more with DB2 (closes #2624)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
4 files changed, 13 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index dd0b71b65f..9b3296b3e4 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -893,7 +893,7 @@ module ActiveRecord connection.select_values( construct_finder_sql_for_association_limiting(options), "#{name} Load IDs For Limited Eager Loading" - ).collect { |id| "'#{id}'" }.join(", ") + ).collect { |id| connection.quote(id) }.join(", ") end def construct_finder_sql_for_association_limiting(options) diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index c04b6b96ff..97f4bcde7f 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -33,7 +33,7 @@ module ActiveRecord 'Abstract' end - # Does this adapter support migrations ? Backend specific, as the + # Does this adapter support migrations? Backend specific, as the # abstract adapter always returns +false+. def supports_migrations? false diff --git a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb index cc0e535123..232971e4ec 100644 --- a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb @@ -1,4 +1,4 @@ -# Author: Maik Schmidt <contact@maik-schmidt.de> +# Author/Maintainer: Maik Schmidt <contact@maik-schmidt.de> require 'active_record/connection_adapters/abstract_adapter' @@ -113,6 +113,14 @@ begin end end + def tables(name = nil) + stmt = DB2::Statement.new(@connection) + result = [] + stmt.tables.each { |t| result << t[2].downcase } + stmt.free + result + end + def columns(table_name, name = nil) stmt = DB2::Statement.new(@connection) result = [] diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb index 56be126c05..c6e82605ee 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb @@ -11,6 +11,8 @@ require 'active_record/connection_adapters/abstract_adapter' # Modifications (ODBC): Mark Imbriaco <mark.imbriaco@pobox.com> # Date: 6/26/2005 # +# Current maintainer: Ryan Tomayko <rtomayko@gmail.com> +# module ActiveRecord class Base def self.sqlserver_connection(config) #:nodoc: |