diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-01 23:34:18 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-01 23:34:18 +0000 |
commit | 65c337ac856f7cbfa521b8e6a7d1d234b4873038 (patch) | |
tree | 46137c4e646cc5a5ccbd343c7c9e5d00767ad6a6 /activerecord/lib/active_record/connection_adapters | |
parent | 49401f880c716aceb0f23051c10bcbd59ed89574 (diff) | |
download | rails-65c337ac856f7cbfa521b8e6a7d1d234b4873038.tar.gz rails-65c337ac856f7cbfa521b8e6a7d1d234b4873038.tar.bz2 rails-65c337ac856f7cbfa521b8e6a7d1d234b4873038.zip |
Fixed schema handling for DB2 adapter that didn't work: an initial schema could be set, but it wasn't used when getting tables and indexes (closes #3678) [Maik Schmidt]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3518 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/db2_adapter.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb index 515444a21e..888b1a8086 100644 --- a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb @@ -112,16 +112,18 @@ begin def tables(name = nil) result = [] + schema = @connection_options[:schema] || '%' with_statement do |stmt| - stmt.tables.each { |t| result << t[2].downcase } + stmt.tables(schema).each { |t| result << t[2].downcase } end result end def indexes(table_name, name = nil) tmp = {} + schema = @connection_options[:schema] || '' with_statement do |stmt| - stmt.indexes(table_name.upcase).each do |t| + stmt.indexes(table_name, schema).each do |t| next unless t[5] next if t[4] == 'SYSIBM' # Skip system indexes. idx_name = t[5].downcase @@ -139,8 +141,9 @@ begin def columns(table_name, name = nil) result = [] + schema = @connection_options[:schema] || '%' with_statement do |stmt| - stmt.columns(table_name.upcase).each do |c| + stmt.columns(table_name, schema).each do |c| c_name = c[3].downcase c_default = c[12] == 'NULL' ? nil : c[12] c_type = c[5].downcase |