Skip to content

Commit

Permalink
Fix booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Jan 26, 2017
1 parent f594d0f commit 5741001
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/active_record/connection_adapters/odbc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def new_column(name, default, sql_type_metadata, null, table_name, default_funct
protected

def initialize_type_map(map)
map.register_type ODBC::SQL_BIT, Type::Boolean.new
map.register_type 'boolean', Type::Boolean.new
map.register_type ODBC::SQL_CHAR, Type::String.new
map.register_type ODBC::SQL_LONGVARCHAR, Type::Text.new
map.register_type ODBC::SQL_TINYINT, Type::Integer.new(limit: 4)
Expand All @@ -152,6 +152,7 @@ def initialize_type_map(map)
map.register_type ODBC::SQL_TIMESTAMP, Type::DateTime.new
map.register_type ODBC::SQL_GUID, Type::String.new

alias_type map, ODBC::SQL_BIT, ODBC::SQL_BIT
alias_type map, ODBC::SQL_VARCHAR, ODBC::SQL_CHAR
alias_type map, ODBC::SQL_WCHAR, ODBC::SQL_CHAR
alias_type map, ODBC::SQL_WVARCHAR, ODBC::SQL_CHAR
Expand Down
2 changes: 2 additions & 0 deletions lib/odbc_adapter/schema_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def columns(table_name, name = nil)
col_nullable = nullability(col_name, col[17], col[10])

args = { sql_type: col_native_type, type: col_sql_type, limit: col_limit }
args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE

if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)
args[:scale] = col_scale || 0
args[:precision] = col_limit
Expand Down

0 comments on commit 5741001

Please sign in to comment.