Fixed DB2 adapter so nullable columns will be determines correctly now and...

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
上级 f46eb2ab
*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
......
......@@ -146,9 +146,10 @@ def columns(table_name, name = nil)
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 @@ def columns(table_name, name = nil)
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' },
......
......@@ -1190,8 +1190,8 @@ def test_to_xml
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册