aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-05-21 15:13:28 +0000
committerMarcel Molina <marcel@vernix.org>2006-05-21 15:13:28 +0000
commitd22f9c948859827f170b9a93820bf06aa720743c (patch)
treef0764860abf25c4d855c9bcf6fe208e8bc23ec34 /activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
parent422cba934c218c7725c115615d942344aa067aba (diff)
downloadrails-d22f9c948859827f170b9a93820bf06aa720743c.tar.gz
rails-d22f9c948859827f170b9a93820bf06aa720743c.tar.bz2
rails-d22f9c948859827f170b9a93820bf06aa720743c.zip
Fix Oracle boolean support and tests. Closes #5139. [schoenm@earthlink.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4351 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
index 6e80707528..44fab82425 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -14,11 +14,12 @@ module ActiveRecord
# +sql_type+ is only used to extract the column's length, if necessary. For example, <tt>company_name varchar(<b>60</b>)</tt>.
# +null+ determines if this column allows +NULL+ values.
def initialize(name, default, sql_type = nil, null = true)
- @name, @type, @null = name, simplified_type(sql_type), null
- @sql_type = sql_type
- # have to do this one separately because type_cast depends on #type
+ @name, @sql_type, @null, @limit = name, sql_type, null, extract_limit(sql_type)
+
+ # simplified_type may depend on #limit, type_cast depends on #type
+ @type = simplified_type(sql_type)
@default = type_cast(default)
- @limit = extract_limit(sql_type) unless sql_type.nil?
+
@primary = nil
@text = [:string, :text].include? @type
@number = [:float, :integer].include? @type
@@ -133,6 +134,7 @@ module ActiveRecord
private
def extract_limit(sql_type)
+ return unless sql_type
$1.to_i if sql_type =~ /\((.*)\)/
end