mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* 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 #3678 [Maik Schmidt]
|
||||
|
||||
* Support the :column option for remove_index with the PostgreSQL adapter. #3661 [shugo@ruby-lang.org]
|
||||
|
||||
* Add documentation for add_index and remove_index. #3600 [Manfred Stienstra <m.stienstra@fngtps.com>]
|
||||
|
||||
@@ -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
|
||||
|
||||
10
activerecord/lib/active_record/vendor/db2.rb
vendored
10
activerecord/lib/active_record/vendor/db2.rb
vendored
@@ -111,17 +111,17 @@ module DB2
|
||||
end
|
||||
|
||||
def columns(table_name, schema_name = '%')
|
||||
check_rc(SQLColumns(@handle, '', schema_name, table_name, '%'))
|
||||
check_rc(SQLColumns(@handle, '', schema_name.upcase, table_name.upcase, '%'))
|
||||
fetch_all
|
||||
end
|
||||
|
||||
def tables
|
||||
check_rc(SQLTables(@handle, '', '%', '%', 'TABLE'))
|
||||
def tables(schema_name = '%')
|
||||
check_rc(SQLTables(@handle, '', schema_name.upcase, '%', 'TABLE'))
|
||||
fetch_all
|
||||
end
|
||||
|
||||
def indexes(table_name)
|
||||
check_rc(SQLStatistics(@handle, '', '', table_name, SQL_INDEX_ALL, SQL_ENSURE))
|
||||
def indexes(table_name, schema_name = '')
|
||||
check_rc(SQLStatistics(@handle, '', schema_name.upcase, table_name.upcase, SQL_INDEX_ALL, SQL_ENSURE))
|
||||
fetch_all
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user