J
jc
I've run into a small bug with DBD::ODBC. The following code:
require 'dbi'
dbh = DBI.connect("DBI:ODBC:dsn", "user", "pass")
puts dbh.columns('table').collect { |c| c.name }
produced the following error:
/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:127 in 'columns'
undefined method '-' for nil:NilClass (NoMethodError
This relates to the following line in ODBC.rb (line 127)
info['precision'] = row['COLUMN_SIZE'] - (row['DECIMAL_DIGITS'] || 0)
It appears this needs to be changed to the following:
info['precision'] = (row['COLUMN_SIZE'] || 0) - (row['DECIMAL_DIGITS']
|| 0)
In case of situations where COLUMN_SIZE is undefined.
require 'dbi'
dbh = DBI.connect("DBI:ODBC:dsn", "user", "pass")
puts dbh.columns('table').collect { |c| c.name }
produced the following error:
/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:127 in 'columns'
undefined method '-' for nil:NilClass (NoMethodError
This relates to the following line in ODBC.rb (line 127)
info['precision'] = row['COLUMN_SIZE'] - (row['DECIMAL_DIGITS'] || 0)
It appears this needs to be changed to the following:
info['precision'] = (row['COLUMN_SIZE'] || 0) - (row['DECIMAL_DIGITS']
|| 0)
In case of situations where COLUMN_SIZE is undefined.