Fixed DB2 adapter so nullable columns will be determines correctly now and quotes from column default values will be removed (closes #4350) [contact@maik-schmidt.de]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4013 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2006-03-22 19:30:02 +00:00
parent f46eb2ab64
commit 2d24bed3a0
3 changed files with 7 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
*SVN*
* Fixed DB2 adapter so nullable columns will be determines correctly now and quotes from column default values will be removed #4350 [contact@maik-schmidt.de]
* Allow overriding of find parameters in scoped has_many :through calls [Rick Olson]
In this example, :include => false disables the default eager association from loading. :select changes the standard

View File

@@ -146,9 +146,10 @@ begin
stmt.columns(table_name, schema).each do |c|
c_name = c[3].downcase
c_default = c[12] == 'NULL' ? nil : c[12]
c_default.gsub!(/^'(.*)'$/, '\1') if !c_default.nil?
c_type = c[5].downcase
c_type += "(#{c[6]})" if !c[6].nil? && c[6] != ''
result << Column.new(c_name, c_default, c_type)
result << Column.new(c_name, c_default, c_type, c[17] == 'YES')
end
end
result
@@ -156,7 +157,7 @@ begin
def native_database_types
{
:primary_key => 'int generated by default as identity primary key',
:primary_key => 'int generated by default as identity (start with 42) primary key',
:string => { :name => 'varchar', :limit => 255 },
:text => { :name => 'clob', :limit => 32768 },
:integer => { :name => 'int' },

View File

@@ -1190,8 +1190,8 @@ class BasicsTest < Test::Unit::TestCase
else
assert xml.include?(%(<last-read type="date">2004-04-15</last-read>))
end
# Oracle doesn't have true boolean or time-only fields
unless current_adapter?(:OracleAdapter)
# Oracle and DB2 don't have true boolean or time-only fields
unless current_adapter?(:OracleAdapter) || current_adapter?(:DB2Adapter)
assert xml.include?(%(<approved type="boolean">false</approved>)), "Approved should be a boolean"
assert xml.include?(%(<bonus-time type="datetime">#{bonus_time_in_current_timezone}</bonus-time>))
end