module ArJdbc::HSQLDB::Column
Private Instance Methods
default_value(value)
click to toggle source
Post process default value from JDBC into a Rails-friendly format (columns{-internal})
# File lib/arjdbc/hsqldb/adapter.rb, line 60 def default_value(value) # JDBC returns column default strings with actual single quotes around the value. return $1 if value =~ /^'(.*)'$/ value end
extract_limit(sql_type)
click to toggle source
Calls superclass method
# File lib/arjdbc/hsqldb/adapter.rb, line 20 def extract_limit(sql_type) limit = super case @sql_type = sql_type.downcase when /^tinyint/i then @sql_type = 'tinyint'; limit = 1 when /^smallint/i then @sql_type = 'smallint'; limit = 2 when /^bigint/i then @sql_type = 'bigint'; limit = 8 when /^double/i then @sql_type = 'double'; limit = 8 when /^real/i then @sql_type = 'real'; limit = 8 # NOTE: once again we get incorrect "limits" from HypesSQL's JDBC # thus yet again we need to fix incorrectly detected limits : when /^integer/i then @sql_type = 'integer'; limit = 4 when /^float/i then @sql_type = 'float'; limit = 8 when /^decimal/i then @sql_type = 'decimal'; when /^datetime/i then @sql_type = 'datetime'; limit = nil when /^timestamp/i then @sql_type = 'timestamp'; limit = nil when /^time/i then @sql_type = 'time'; limit = nil when /^date/i then @sql_type = 'date'; limit = nil else # HSQLDB appears to return "LONGVARCHAR(0)" for :text columns, # which for AR purposes should be interpreted as "no limit" : limit = nil if sql_type =~ /\(0\)$/ end limit end
simplified_type(field_type)
click to toggle source
Calls superclass method
# File lib/arjdbc/hsqldb/adapter.rb, line 45 def simplified_type(field_type) case field_type when /^nvarchar/i then :string when /^character/i then :string when /^longvarchar/i then :text when /int/i then :integer # TINYINT, SMALLINT, BIGINT, INT when /real|double/i then :float when /^bit/i then :boolean when /binary/i then :binary # VARBINARY, LONGVARBINARY else super end end